answersLogoWhite

0


Best Answer

Q: What is the very first element of array 'argv' is good for?

A: It contains the name of the actual program. Try it: printf ("I am '%s'\n", argv[0]);

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Some solved question of array in C programming?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How do you set the null value in array?

Depends on the programming language, some languages may have already initialize an array with null (or the default value of the type), some of them require explicitly assignments by stepping through each element of that array, and assigning them with null. (imperative languages)


Is it necessary to give the size of array?

Depends on the language. For C, no you don't. You can type blank brackets (int Arr[]) when declaring the array, or you can just use a pointer (int* Arr). Both will allow you to use the variable as an array without having to declare the specific size. Hope this answers your question. In Java, an array is an object, and one which is dynamically allocated space. The default constructor does not require a size be specified.


What are the main features of arrays. How are arrays used and created?

AnswerWhat is an array: In programming languages, an array is a way of storing several items (such as integers). These items must have the same type (only integers, only strings, ...) because an array can't store different items. Every item in an array has a number so the programmer can get the item by using that number. This number is called the index. In some programming languages, the first item has index 0, the second item has index 1 and so on. But in some languages, the first item has index 1 (and then 2, 3, ...).


What is the difference between a string and an array?

Nothing whatsoever. A string is simply an array of type char. In some programming languages, such as C, a string is an array of char (or short), terminated with a null \0. An array is just a fixed size of collection, a container to hold things/objects. If all the elements in the container are characters (of char), then we may call it a string, sometimes a byte array (because each character can be represented as a byte). An array of 7 different days, it maybe a WEEK, or just the birthdays of 7 dwarfs. Then they are nothing to do with strings. A data item (or variable) is described as a "string" type when it contains some number of characters. Those characters can usually be anything in the system's accepted list of codes. Most systems use ASCII, so a string can include the letters a-z, A-Z, numbers 0-9, and special characters like ~!@#$%^&*()_+-=[]\{}|:";'<>?,/. A string is treated as a single object, although most programming languages have methods to break strings apart (called sub-stringing). In the Perl language, strings are named $something. An array is a collection of individual data items, sort of like a list. Each element in an array can be referred to in a program by its position in the list. In the Perl language, an array would be named @SOMETHING. The first element in the array would be named $SOMETHING[0], the second $SOMETHING[1], and so on. Each element can be a string, or some other data type. Other data types would be integers (positive or negative whole numbers), floating point (decimal numbers like 3.14159 or 2398.41; it can be more complicated than this, but that's another story), and a few more exotic types. In the C programming language a string is actually the same as an array of characters. The last character in a C string is a zero byte which indicates the end of the string.


Why should all of the elements in an array have the same data type?

Yes all of the elements in array must be the same type. Because when you define an array you specify the type of data it will hold. Examples in C: int IntArray[10]; // an array of 10 integers double FloatArray[20]; // array of 20 double floating point numbers

Related questions

How do you draw an array to solve a problem?

The answer will depend on what the problem is: some can be solved using an array but for others, arrays are a complete waste of time.


Can you get 4th sem Anna university solved Probability and queuing theory question papers?

give some solved question paper


How do you set the null value in array?

Depends on the programming language, some languages may have already initialize an array with null (or the default value of the type), some of them require explicitly assignments by stepping through each element of that array, and assigning them with null. (imperative languages)


Is it necessary to give the size of array?

Depends on the language. For C, no you don't. You can type blank brackets (int Arr[]) when declaring the array, or you can just use a pointer (int* Arr). Both will allow you to use the variable as an array without having to declare the specific size. Hope this answers your question. In Java, an array is an object, and one which is dynamically allocated space. The default constructor does not require a size be specified.


How you use negative index in array?

You cannot do this easily in C programming. Arrays in C always start with index 0. If you must use a negative array index, you can do that by allocating an array, and then pointing to an element within the array. Say you allocate an array 10 ints long, named a; then set b = &a[5]. Then b[-4] = a[1]. However, this is extremely bad programming practice and is almost certain to cause data corruption. Some compilers will treat array indices as unsigned, also, so that when you specify b[-4], the compiler will internally simplify that to b[65532] and your program will crash.


What is an arraying?

An array is an aggregate of data elements of the same type. Arrays are allocated in contiguous memory. An element of an array can be another array type, also known as a multi-dimensional array.


What are the main features of arrays. How are arrays used and created?

AnswerWhat is an array: In programming languages, an array is a way of storing several items (such as integers). These items must have the same type (only integers, only strings, ...) because an array can't store different items. Every item in an array has a number so the programmer can get the item by using that number. This number is called the index. In some programming languages, the first item has index 0, the second item has index 1 and so on. But in some languages, the first item has index 1 (and then 2, 3, ...).


How are entire arrays passed from one method to another?

In some programming languages, like C, you can pass the new method (or function) an address pointer to the first element in the array. As long as you don't leave the scope of the method the array was created in, the array will remain valid. In other languages that don't support memory addresses, like FORTRAN, it must be done by making the array global.


SMU BBA Sem 2 some sample question of Quantitative Techniques in Management?

Quantitative Techniques in Business solved question


What is a for every statement?

That is also known as "FOR EACH", though in some programming languages it is simply written as FOR. It means that a group of statements are to be executed once FOR EVERY item in a set. For example (depending on the programming language), that might be once for every array element.


Explain Single dimensional array concepts C programming?

The idea of an array is to store data for different related items, using a single variable name. The different items are distinguished by a subscript (a number, which may also be a variable or some other expression)


Where can you get c programs for games?

C is the programming language (some) games are written in, your question makes no sense.