I apologized that I did not show the inputs. The inputs are:
Add
the
Sam
key
Thanks
User Profile
Collapse
-
Regarding scanf and fgets
Hi. The following is my code of an example:
#include <stdio.h> /*line 1*/
main() /*line 2*/
{char *command = (char *)calloc(10, sizeof(char)); /*line 3*/
char *middle = (char *)calloc(10, sizeof(char)); /*line 4*/
char *name = (char *)calloc(20, sizeof(char)); ... -
Question regarding scanf
Hi all. I am beginner in C. My question is: What is " \n" inside scanf()?
Here is part of the implementation of an example:
...
char myChar;
int myID;
scanf("%c", &myChar);
scanf("%d\n"; &myID);
printf("Option: %c, ID: %d\n", myChar, ID);
...
The reason that I break scanf() into 2 parts is that I need to take either one argument... -
How to create pointer array by memory allocation?
Hi. I am new to the C language. I need to store the commands from input to a pointer array without any "[]"declaratio n. How to create an pointer array by memory allocation? I tried to use the following statement, but it did not work.
static char **choice = (char **)calloc(NUMBE R_COMMAND,sizeo f(char **));
I want to declare this array as private and use by all functions, so I use "static".
T...
No activity results to display
Show More
Leave a comment: