what is difference between array of characters and string

Answer Posted / shayan

the main difference between array of char and string is that when we declare array of char like char name[6],in this case for example shayan s is stored in 0 index and last character is n which is at 5 index but i delared 6 because 6th index is of null character which is neccesary to declare but in string it will automatically declare by the compiler like "shayan" after n compiler automatically put \0 after n.

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the code in while loop that returns the output of given code?

1287


i want to switch my career from quailty assurance engineering to development kindly guide me from which programming language its better for me to start plz refer some courses or certifications too i have an experience of 1.5 yrs in QA field.Kindly guide me

1475


What is actual argument?

582


What is the advantage of a random access file?

633


write a proram to reverse the string using switch case?

2456






How can I call a function with an argument list built up at run time?

622


What does calloc stand for?

641


the factorial of non-negative integer n is written n! and is defined as follows: n!=n*(n-1)*(n-2)........1(for values of n greater than or equal to 1 and n!=1(for n=0) Perform the following 1.write a c program that reads a non-negative integer and computes and prints its factorial. 2. write a C program that estimates the value of the mathematical constant e by using the formula: e=1+1/!+1/2!+1/3!+.... 3. write a c program the computes the value ex by using the formula ex=1+x/1!+xsquare/2!+xcube/3!+....

22180


What is difference between stdio h and conio h?

876


Is array name a pointer?

597


In cryptography, you could often break the algorithm if you know what was the original (plain) text that was encoded into the current ciphertext. This is called the plain text attack. In this simple problem, we illustrate the plain text attack on a simple substitution cipher encryption, where you know each letter has been substituted with a different letter from the alphabet but you don’t know what that letter is. You are given the cipherText as the input string to the function getwordSets(). You know that a plain text "AMMUNITION" occurs somewhere in this cipher text. Now, you have to find out which sets of characters corresponds to the encrypted form of the "AMMUNITION". You can assume that the encryption follows simple substitution only. [Hint: You could use the pattern in the "AMMUNITION" like MM occurring twice together to identify this]

1951


Tell me what is null pointer in c?

603


Write a simple code fragment that will check if a number is positive or negative.

700


Why dont c comments nest?

611


Explain what will be the outcome of the following conditional statement if the value of variable s is 10?

736