Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Assignment 8
//gcc 5.4.0 /* Write a C program that searches for a given value in an array of characters. The program should return the index of the value if it exists, otherwise, it should print -1. You can initialize the array in your code by an input string. (a) Write a pseudocode for this program (b) Implement your pseudocode in C. (c) Test You program using the following code: a. Input string: “The George Washington University” and search for the characters: ‘W’, ‘w’, ‘!’, ‘n’, ‘ ‘ */ #include <stdio.h> int main(void) { int n; char name[30]="The George Wasington University"; n=sizeof(name); for(int i=0; i<n; i++){ if (name[i]=='W'){ printf("W detected\n"); } else if (name[i]=='w'){ printf("w detected\n"); } else if (name[i]=='!'){ printf("! detected\n"); } else if (name[i]=='n'){ printf("n detected\n"); } else if (name[i]==' '){ printf("' ' detected\n"); } else{ printf("No elements being detected %-1\n"); } } return 0; }
run
|
edit
|
history
|
help
0
Print Micro Seconds
fgets and basic string manipulation
Stub Program for Problem 6 HW 2
CS HW2
A.c
Assignment 3
day 3 integer manipulation
Linked List demo in C
sizeof human
Assignment 2