I have a few questions about C syntax.
ch = (char *) malloc( sizeof( char ) * strlen(src) );
What do the first brackets mean (char *) ?c=getch();
switch(c) {
case '1' :{
My teacher asked why 'this type' quotation marks are used and not "double". I said that it is C syntax if using char variable. But he said NO! Why are single quotation marks used and not double?
Sometimes when using
scanf
nothing happens and it has be used two times to get something scanned. What is the reason of this problem? For example:printf("enter string \n"); scanf("%s",&str); printf("enter char \n"); scanf("%c",&ch); //does not scan my char scanf("%c",&ch); //with this second line do scan my char