basic question in C

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ikilobo
    New Member
    • Jun 2010
    • 3

    basic question in C

    helo, i wanna ask a basic question in my C program below

    Code:
    #include<stdio.h>
    
    unsigned m,n;
    unsigned a[100];
    unsigned b[100];
    
    c=a; m>=n; //error in this line, why??
    for (int i=0; i<n; i++){
        c[i]=c[i]^b[i]
        }
    return c;
    error msg:
    [warning]initialization makes integer from pointer without a cast
  • csuft20083800
    New Member
    • Jun 2010
    • 1

    #2
    "initializa tion makes integer from pointer without a cast".That means you you cann't assign a pointer to a integer variable.In this case,'a' is a pointer and 'c' is a integer variable.You can change the declaration as follows:
    Code:
     int* c ;
     c = a ;
    Any questions please send me a message.

    Comment

    • akinidu
      New Member
      • May 2010
      • 7

      #3
      Where is your main function
      Code:
      int main (){
      }

      Comment

      • whodgson
        Contributor
        • Jan 2007
        • 542

        #4
        a and b are empty arrays.
        m and n are not initialized.
        you are attempting to XOR a[i] with b[i]using (^) when the elements at best are assigned 0.
        Plus as akinidu points out your main() function with return 0; is missing.

        Comment

        Working...