In the recent interview, I was asked, what is your favorite subject. I said C programming. The next question was, What is the difference between Table and Array?
Can anyone help me with it. I have never heard about tables in C.
-
1C doesn't have a language nor library feature named "tables". I suspect your interviewer was either terribly ignorant of the language (or used very incorrect terminology for a 2D array) or it was a trick question. How did you respond and how did your interviewer respond to your answer?Dai– Dai2018-08-11 16:35:49 +00:00Commented Aug 11, 2018 at 16:35
-
table could refer to map or dictionary, that depend of your interpretation of what is a table.Stargateur– Stargateur2018-08-11 16:36:09 +00:00Commented Aug 11, 2018 at 16:36
-
You should have said that in the interview. If you tried to wing it and made something up then you probably won't hear back.Hans Passant– Hans Passant2018-08-11 16:37:03 +00:00Commented Aug 11, 2018 at 16:37
-
The first thing "table" makes me think of is SQL or a relational database. There are lots of ways of implementing a table-like data structure in C. Very poor interview question, I'd say. (Unfortunately, of course, there's no line judge who can give you credit if you fail to properly answer what turns out to have been a poor or unanswerable question.)Steve Summit– Steve Summit2018-08-11 16:50:41 +00:00Commented Aug 11, 2018 at 16:50
-
1An array is where the data is kept in your program. A table is how you present that data to the user.Weather Vane– Weather Vane2018-08-11 17:37:28 +00:00Commented Aug 11, 2018 at 17:37
3 Answers
Array is a built-in feature of the C language. Table is used by Programmer to write C program, along with Chair and Computer.
Arrays decay into pointers to their first element in most expression contexts.
Tables decay into dust and rust, which may or may not replace C in the long run.
1 Comment
There is no concept of table in C programming. Probably you could have asked the interviewer, did he mean by multi-level array OR array of arrays.
1 Comment
From a typical idioms point of view, I would say: think about the common expressions “indexed array” and “lookup table”. When I say “indexed”, “adressable” is to be read too. A computer’s memory is an array, while in a database, you have tables. One may say an array is a special case of table.