What is the difference between array and ordinary variable in C?

Array is the set of an multiple values where as variable can store single value at a time.

• The difference between the definition of array and ordinary variable is the, array is always declared, initialized, and accessed using subscript whereas ordinary variable do not have any subscript.


• The syntax for ordinary variable definition is data_type v1, v2, ….;

• And the syntax for array variable is data_type v1[N1],v2[N2],…; where v1,v2 are name of variable and N1, N2 are the integer constants indicating the maximum size of array.


14 comments:

  1. Array have consecutive memory locations...
    Two or more variables may or may not have consecutive memory locations!!!

    ReplyDelete
  2. thanks much more if u can

    ReplyDelete
  3. thanx dude it really workout for xams.

    ReplyDelete
  4. thanks a lot. it really helped in my exams. very good explanation.

    ReplyDelete
  5. thanks a lot. it really helped in my exams. very good explanation.

    ReplyDelete
  6. Thanx u guys. Completely helpful for my internal exam

    ReplyDelete
  7. Thanks a lot . I helps me for my internals.

    ReplyDelete
  8. Thank you so much .it is very helpful to me

    ReplyDelete
  9. Tum shut Karo because is vishya
    Screen mein display NAHI aye

    ReplyDelete
  10. Variable have single box in memory of sigle type..where as array have larget box of same data type.

    ReplyDelete