-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProblem_Set_22.c
More file actions
37 lines (31 loc) · 895 Bytes
/
Problem_Set_22.c
File metadata and controls
37 lines (31 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Create a String firstName & lastName to store details of user & print all the characters using a loop.
/*#include <stdio.h>
void printString(char arr[]);
int main()
{
char firstName[] = "Sayanjit";
char lastName[] = "Jana";
printString(firstName);
printString(lastName);
return 0;
}
void printString(char arr[])
{
for (int i = 0; arr[i] != '\0'; i++)
{
printf("%c", arr[i]);
}
printf("\n");
}*/
// Ask the user to enter their firstName & print it back to them.Also try this with their fullName.
#include<stdio.h>
int main(){
/*char firstName[100];
scanf("%s",firstName);
printf("My Name is %s",firstName);*/
char str[100];
gets(str); // Dangerous & Outdated input a string(even multiword)
fgets(str,100,stdin); // Stops when n-1 chars input or new line is entered.
puts(str); // Output a string
return 0;
}