Why my code has error?


  • 0
    C

    int* twoSum(int* nums, int numsSize, int target) {

    int i,j;
    int m=0,n=0;
    for(;m<numsSize;m++)
    {
        i=*(nums+m);
    	n=0;
        for(;n<numsSize-1;n++)
    {
    
        j=*(nums+1+n);
        if(target==(i+j)&&(i<=j))
        printf("index1=%d,index2=%d",m+1,n+2);
    }
    }
    return 0;
    

    }

    int _tmain(int argc, _TCHAR* argv[])
    {
    int s[100]={3,2,4};
    int t=6;
    twoSum(s,3,t);
    return 0;
    }


  • 0
    H

    Your return type is int* and you return a 0.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.