| Forum |
|
|||||||
| Programming The destination for developers - C, C++, Java, Python and the lot |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Hey here is the aks
Join Date: Jan 2006
Location: punjab
Posts: 801
|
____1 ___12 __123 _1234 12345 _1234 __123 ___12 ____1 all the underscores or lines are just blank spaces.i have to print only numerals Plz help me..i m in little hurry plz help me and any body plz tell me in C what is the maximum variable name length size limit.. In some books it is written only 8 characters but in some book i is written 32 and in another it is written 247 characters.... I wanna know what does real C supports .... actually we always write and execute C program in turbo C++ compiler so according to me there is different limits on maximum lenght of a variable name by turbo c and turbo c++ compiler... So plz tell me what is that
__________________
yours truly arun The aks!! have a nice day Last edited by arunks; 16-08-2007 at 10:46 PM. |
|
|
| Advertisements. Register and be a member of the community to get rid of them. | |
|
Advertisement
|
|
|
|
#3 (permalink) |
|
In The Zone
Join Date: Jul 2006
Location: Coimbatore
Posts: 403
|
this is easiest pgm possible....
#include<stdio.h> #include<conio.h> void main() { int i,j,n; clrscr(); printf("Enter the value of n: "); scanf("%d",&n); for(i=1;i<=n;i++) { for(j=1;j<=i;j++) { printf("%d\t",j); } printf("\n"); } for(i=n-1;i>=1;i--) { for(j=1;j<=i;j++) { printf("%d\t",j); } printf("\n"); } getch(); } |
|
|
|
|
#4 (permalink) | |
|
Hey here is the aks
Join Date: Jan 2006
Location: punjab
Posts: 801
|
ya plz help me and any body plz tell me in C what is the maximum variable name length size limit.. In some books it is written only 8 characters but in some book i is written 32 and in another it is written 247 characters.... I wanna know what does real C supports .... actually we always write and execute C program in turbo C++ compiler so according to me there is different limits on maximum lenght of a variable name by turbo c and turbo c++ compiler... So plz tell me what is that
Quote:
thanx for fast reply and thanx for ur program but that program displays this 1 12 123 1234 12345 1234 123 12 1 but i want this ____1 ___12 __123 _1234 12345 _1234 __123 ___12 ____1 plz see again
__________________
yours truly arun The aks!! have a nice day Last edited by arunks; 16-08-2007 at 10:52 PM. Reason: Automerged Doublepost |
|
|
|
|
|
#5 (permalink) |
|
NP : Crysis
Join Date: Mar 2007
Location: City 17
Posts: 1,415
|
here this will give proper ouput.
but it is C++. u just need to tweak it a little bit. replace the cout and cin commands with printf and scanf respectively Code:
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,j,n;
cout<<"\n\nEnter limit-->\t";
cin>>n;
for (i=1;i<=n;i++)
{
for (j=1;j<=n-i;j++)
cout<<" ";
for (j=1;j<=i;j++)
cout<<j;
cout<<endl;
}
for (i=1;i<=n;i++)
{
for (j=1;j<=i;j++)
cout<<" ";
for (j=1;j<=n-i;j++)
cout<<j;
cout<<endl;
}
getch();
}
__________________
Gaming: Phenom II x4 965BE @ 3.6Ghz/Corsair H50 Liquid Cooling/MSI 790FX-GD70/2x2GB GSkill Ripjaws 7-7-7-24/3 x GTX 470 w/Zalman VF3000F/Corsair 850W PSU/Antec 1200/2xSpinpoint F3 500Gb RAID 0 |
|
|
|
|
#6 (permalink) |
|
Hey here is the aks
Join Date: Jan 2006
Location: punjab
Posts: 801
|
@xbonez
thank you very much..ur code is working correct... but guys what abt my other question abt variable length size maximum in c
__________________
yours truly arun The aks!! have a nice day |
|
|
|
|
#7 (permalink) |
|
Banned
Join Date: May 2004
Location: Baudland
Posts: 2,430
|
all those who r giving away the proper code should realise that by doing so you r in no way helping the thread starter acquire proficiency in programming
let d thread starter first try to do it and show it 2 us and then v cud help him out by pointing out where he is going wrong, instead of blindly giving away d code |
|
|
|
|
#8 (permalink) |
|
Apprentice
Join Date: Sep 2006
Location: Mumbai
Posts: 65
|
Well regarding as to the variable length size i did not get what that means...if it is the variable name length (As in the int num, here num is of length 3) then it depends upon what compiler you use if it is ANSCI C99 based then it is 31 for variables (identifiers) which are external and 63 characters for the internal identifiers. Although if you are using something like gcc or MSVC then you don't need to worry about variable length at all. Rest assured the length is a relatively big number.
If on the other hand what you mean is bit length of a variable (data type assumed is an int) then on almost all modern compilers(and hence modern systems an int is treated as long int that is 4 bytes and not 2 bytes as used to be the case earlier. And I suggest you should really try and write your own programs and not ask for them if you really want to do something in programming....and also try and lookup for answers for questions like that of yours. Googling for answers(and not for code) is a good option Best Luck
__________________
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction. |
|
|
|
|
#9 (permalink) |
|
God of Mistakes...
Join Date: Dec 2005
Location: Pune, Maharashtra
Posts: 1,905
|
If u r talking abt the Data type wise length, then use "sizeof" operator.
ex. Code:
void main()
{
int a;
float b;
printf ("Size of Interger is : %d", sizeof(a));
printf ("\nSize of Float is : %d", sizeof(b));
getch();
}
__________________
Registered Linux User #468778 ---------------------------------- http://twitter.com/_Garbage_ |
|
|
|
|
#10 (permalink) | |
|
s,b+..u cn..
Join Date: Dec 2006
Posts: 76
|
Quote:
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Please guys help me | Sonali jain | Software Q&A | 3 | 31-08-2006 07:32 PM |
| Just look it guys | Third Eye | Gamerz | 4 | 07-08-2006 10:18 PM |
| NEED A LITTLE HELP GUYS... | Slam Team | QnA (read only) | 12 | 16-06-2005 05:29 AM |
| 939 or 754...what u guys think?? | parimal | QnA (read only) | 2 | 31-01-2005 01:26 PM |