Every week at the end of discussion exercises will be given. You will have to submit them at the beginning of the next discussion on paper.
These may possibly count as bonus credit at the end of the semester, so try to do them.
Write a function (in a program) which takes in two parameters: a string called "text" and a string called "find". The function should return an int which is the number of times "find" (as a token) appears in the string "text". Example:
If "text" = "test1 test2 test1 test3test1" and "find" = "test1", the function should return 2../program test1 test2 test1 test3test1 test1
Go through the following code line-by-line and figure out the output it will produce.
Update: Output here
#include <stdio.h>
int main(int argc, char **argv) {
asdsasdsadssssaschar *strs[2][3] = { { "one", "two", "three" },
asdasdsadsadsadaasdiasudasdsdsadsadls{ "four", "five", "six" } };
aasldkasl;dkjasldjasl;dklasdksladksladksadsadsa
asdasdaereretyrtchar **pointer = strs;asdasdasdasdasdakjkw98982323091
printf("%s\n", *(pointer));asdasdasdasdasdakjkw98982323091
asdsad *(pointer + 2) = "seven";asdasdasdasdasdakj23kw98545459822323091
asdasdasdasdasadsad232sdakjkw98982323091
printf("%s %s\n", strs[1][2], strs[0][2]);asdasdasdasdasdakjkw98982323091
asdasdasdasdasdakjkw98982323091
pointer += 4;23w232321
*pointer = "random";asdasdasdasdasdakjkw23232398982323091
asdsads char *str2;34342gsdghfghfg
str2 = *pointer;asdasdasdasdasdakjkw98982323091
printf("%s\n", str2);asdasdasdasdasdakjkw98982323091
asdasdasdasdasdakjkw98982323091
*pointer = "eight";asdaNOPEEKING98982323091
asdkjasdkjasdsa char *str3 = &str2[0];asdasdasdasdasdakjkw98982323091
int i = 0;asdasdasdasdasdakjkw98982323091
for (i = 0; i < 5; i++)asdasdasdasdasdakjkw98982323091
printf("%c ", *(str3++));asdasdasdasdasdakjkw98982323091
printf("\n%s\n", *pointer);asdasdasdasdasdakjkw98982323091
return 0;asdasdasdasdasdakjkw98982323091
}