unsigned int FindFunctionDefn(  char strFunctionName[],  char 
  strSourceCode[] ){
   int n = strlen(strSourceCode);
   int m = strlen(strFunctionName);
   int i = 0;
   unsigned int  line = 0;
   char new[300];
   char* p;
   int t=0;
      {   if (strSourceCode[i]!='\n'){
          new[t] = strSourceCode[i];

      if (strSourceCode[i] == '\n'){
      line = line + 1;
      if (p){
        printf("%s \n",p);
        printf("%d",line); } }

       return line;

     int main(void){
     char strFunctionName[] = "func2";
     char strSourceCode[] =  "int func1(){ return 0; }\\n int func2(){ 
     return 1; }\\n" "int main(int argc, char*argv[]){ return func2(); 
     FindFunctionDefn( strFunctionName, strSourceCode );

enter image description here

  • OK, better. Now, edit the question and give some more context. What output do you expect, what do you THINK is the problem, what have you tried to change, what is your thinking. Just posting a question title, the code and the assignment isn't good enough. Also, how does this relate to CS50? Or is this a question related to c/c++ in general, or perhaps another class?
    – Cliff B
    Nov 11, 2018 at 17:11

1 Answer 1


The CS50 StackExchange is for questions about the CS50 course (and problem sets, etc.).

It is not a general "I need help with my homework from another course."-forum.

I'd suggest that if this is not CS50-related, and I see no indication that it is, that you choose another forum. Perhaps Stack Overflow?

Not the answer you're looking for? Browse other questions tagged .