string - String Programs Program1 #include <stdio.h>...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
String Programs Program1 #include <stdio.h> #include <string.h> int main(void) { char name1[20], name2[20]; printf("\nInput First Name : "); scanf("%s",&name1[20]); printf("Input Last Name : "); scanf("%s",&name2[20]); printf("\n The Name is %s %s", name1, name2); getchar(); getchar(); return 0; } Program2 #include <stdio.h> #include <string.h> int main(void) { char name[20]; printf("\nInput Your Name : "); gets(name) ; printf("\n The Name is %s",name); getchar(); getchar(); return 0; } Program 3 #include <stdio.h> #include <string.h> int main(void) { char text[10]; char *text2 = "HelloStudents"; strncpy(text, text2, 5); text[5] = '\0'; printf("%s\n",text); getchar(); getchar(); return 0; }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Program 4 #include <stdio.h> #include <string.h> int main(void) { char *text = "Borland International"; printf("%d Characters \n", strlen(text)); getchar(); getchar(); return 0; } Program 5 Join the text #include <stdio.h> #include <string.h> int main(void) { char destination[25]; char *x = " ", *c = "C++", *y = "Borland";
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

string - String Programs Program1 #include &lt;stdio.h&gt;...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online