Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
String Manipulation
#include <stdio.h> #define SIZE 30 int main(void) { // my array for the string char myString[SIZE]; int stringLength = 0; printf("Example program for some string manipulations.\n"); // First read in an input string // to read in strings: fgets(array of characters, size, standard input from library stdio.h) if (fgets(myString, SIZE, stdin)) { // find the length of the string while (myString[stringLength] != 0) { stringLength = stringLength + 1; } // print the string // printf(container, variable name) // represent containers with % and then the particular letter // to print as a string, use %s // to print as a decimal, use %d printf("Length of %s is %d.", myString, stringLength); } else { printf("Error reading in the string!\n"); } return 0; }
run
|
edit
|
history
|
help
1
Please
log in
to post a comment.
Max successs
b=1 c=1
PuntosTriangulo
String copy
final advice
bitmask shift
A_141117_Euclides
Lab 9 v1
Star 1,3
example of scanf and basic integer manipulation
stackse - search stackoverflow differently
Please log in to post a comment.