answersLogoWhite

0


Best Answer

I guess you wanted to ask, why is it scanf ("%s", array)and not scanf ("%s", &array).

Well, array is by definition a pointer to the first element: array = &array[0]

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why and is not using ' and ' in reading a string using scanf?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How can we read two strings using c program?

#include,stdio.h>main(){char string1[20],string2[20]printf("enter the first string");scanf("%s",string1);// reading the string1printf("enter the second string");scanf("%s", string2);// reading the the string2printf( "the first string is %s",string1);// printing the string1printf("the second string is %s",string2);// printing the string2}the problem of using scanf is that it does not take space. so we can use gets for it.ie instead of scanf("%s",string1); we can use gets(string1); .


What are the components of print f and scan f?

printf: format string + value list scanf: format string + address list


C program to accept a sentence using scanf?

scanf ("%[^\n]s", sentence);


Can you use scanf to get a string to a c program?

Certainly. That's what sequence %s is good for.


What is the purpose of scanf in c language?

scanf is used for reading formatted data from stdin. The general syntax is:scanf( format , arguments);For more information on scanf, visit the link below.


What happens by the 'scanf' statement in C programming language?

By using the scanf statement in c,we can take the values at run time . for ex a is a variable of type int so, we can assign the value of a using scanf at run time as follows. scanf("%d",&a); here %d is the conversion specifier for integer type.


What are the limitations of getchar and scanf functions for strings?

cause getchar only read a character and scanf read only word before first space but not other words and letters.


Program to find palindrome using C programming?

#include<stdio.h> #include<conio.h> #include<string.h> void main() { char a[15],b[15]; printf("Enter the string\n"); scanf("%s",&a); strcpy(b,a); strrev(a); if(strcmp(a,b)==0) printf("The String is a palindrome"); else printf("The String is not a palindrome"); }


How do you read input buffer of keyboard using C?

scanf();


What is the prototype of scanf in c programmin?

int scanf(char* format, ...); the format accepts the format specifier string, the elipsis operator accepts the variable list scanf("var type var type ...", &var, &var, ...); example: int num1, num2, num3; scanf("%d %d %d",&num1,&num2,&num3); Is that what you were looking for? Maybe this can help also...


Program to find the size of the string in c?

int main (void) { char buf[1024]; scanf ("Enter a string: %s", buf); printf ("The length of the string is %d chars long.\n", strlen (buf)); return 0; }


Can you specify variable field width in scanf format string?

AnswerYou can't specify a variable field with a fixed format string, but you can get around this by making the format string variable:int width; char format[20]; /* or whatever size is appropriate */ int value; ... sprintf(format, "%%%dd", width); /* generates a string like "%5d" */ scanf(format, &value); The only drawback to this method, other than requiring two statements, is that the compiler can't do a sanity check on the arguments to scanf like it can when the format is a string constant.AnswerIf you want to specify a variable width in a printf format string (as opposed to scanf), you can do the following:printf("%*d", width, num);That will use the value of "width" as the width for formatting the value of "num" as a decimal integer.