Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
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
Spring 2017 Project 2 v1
Avance de guia 4- Pregunta 1
PuntosTriangulo
FILE_Access
time conversion1
Project 3 Part 1 v0.5
Project 5 v0.11
example of scanf and basic integer manipulation
150114_MatrizSumaPerimetro
Assignment 3 Final