How to receive strings with spaces in scanf()
Answers were Sorted based on User's Feedback
Answer / vignesh1988i
#include<stdio.h>
#include<conio.h>
void main()
{
char a[50];
printf("enter the string :");
for(int i=0;1;i++)
{
scanf("%c",&a[i]);
if(a[i]=='\n')
a[i]='\0'
break;
}
for(i=0;a[i]!='\0;i++)
printf("%c",a[i]);
getch();
}
Is This Answer Correct ? | 4 Yes | 3 No |
Answer / suman halder
#include<stdio.h>
int main()
{
char str[100];
scanf("%[^\n]s",str);
}
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / murugannr
#include<studio.>
#include<coino.>
viod main
{
int a,b:
char a[12];
char b[10];
Printf{"enter the using string a,b");
scanf("%s,%a,%b");
get(ab)
}
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / parmjeet kumar
#include<stdio.h>
#include<conio.h>
void main()
{
char a[50];
printf("enter the string:");
scanf("%s",&a);
printf("%s",a);
getch();
}
Is This Answer Correct ? | 0 Yes | 10 No |
Can anyone tell what is stack overflow? what precaution we should take?
Write an algorithm for a program that receives an integer as input and outputs the product of of its digits. E.g. 1234 = 24, 705 = 0
program to find middle element of linklist?
1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
How do you do dynamic memory allocation in C applications?
Which of the following are valid "include" formats? A)#include and #include[file.h] B)#include (file.h) and #include C)#include [file.h] and #include "file.h" D)#include <file.h> and #include "file.h"
Why does the call char scanf work?
how memory store byte
program to print upper & lower triangle of a matrix
write a c program to find the sum of five entered numbers using an array named number
what is the use of getch() function in C program.. difference b/w getch() and getche()??
29 Answers HCL, IBM, Infosys, TCS, Wipro,
Write one statement equalent to the following two statements x=sqr(a); return(x); Choose from one of the alternatives a.return(sqr(a)); b.printf("sqr(a)"); c.return(a*a*a); d.printf("%d",sqr(a));