CAN YOU GIVE ME THE CONVERSION SPECIFIER ( % ) FOR THE CHAR TYPE? example: for integer its %d --what about the char type? float: %f--what about the char type?
guess: %c ??? (or that only gives the one character?
please tell me the exact conversion specifier so I can make this code more better and in more detail after compiliation.
or they both the same or they are different? : is one an array of char, and the other one is a string of char? or they both the same or what? my_age is an char type (variable) that holds one byte that will nicely fit into the array / or string?
Can this be compiled?
puts("Enter your name";
if (name > 20 ) ;
puts("Too many characters
"; /*take out newline?*/
puts("Thanks for your name";
puts("Enter your lastname";
if (lastname > name ) ;
puts("Your lastname is bigger";
puts("Your first name is bigger";
puts("Enter your age in a full sentence";
puts("Its not in a sentence";
puts("Thanks for the sentence";
if (age > 100 ) ;
puts("Wow, your age!";
", age ) ; /*%c--? */prints single character?,'age' is a whole character/*
#define (age) ; /*whatevers the users age?, or 100);its is 'ages' variable(all char) /*
char array=age, name, lastname ) ;
/*is that a true array? if not, give me the real code for it /*
is this the one right? :
char array=100, 20 30 ) ;
for (age=100; (age > 2 ) age++ ) ;
for (name=20; (name > 2) name++ ) ;
if intcmp (age > name ) ;
", age, name ) ; /*%s used for char? or single character? again, give me the conversion specifier/*
correct the above code and give me it the right away block by block if (some) parts are incorret.
Please answer this important question:
Is the conditional part of the for loop:
name > 2 ); 2 is the dimension of the array (the number in the bracket) is that what you put in a for loop? have to declare a char array for this type char stuff before the for loop?
Strings: why do we need strings when we got arrays? (I cant find strings useful) what are they used for? like I did the code above, the start of it as I am passing the gets call to get the users name into my program,(is that the only field where the strings are useful( but that is not the kind of string that uses comparsions and lenght functions from <<string>>.h
Its just a normal character array(is it a string) or if the users typed in a long string in the GETS area at the start of my code , it will al go in the character array holding that much memory for it?
or if the users typed in a long string passed the value of the char array 'name' , will an error come?
or do I have to increase the value of the first char array? or is it a string?
Or should I use 'else' like I did above, to have the two freedom ways from the user, incase the user typed in something long that I did not programmed it for(a long string) , an error will come? this is something similiar:
puts("Thanks for your info";
It looks like you're new here. If you want to get involved, click one of these buttons!