This kind of exercise requires a minimal amount of mathematics and logic.
In C, strings are character arrays, and the variables used to contain strings actually contain the location (or "address") of the first character. The last character in the string is ASCII 0 (NUL), which signals the end of the string.
This problem requires you first know how long the string is, and for this purpose you would use "strlen". Assuming you have an integer variable called "length" and a string called "str", this assignment would store the length of "str" into "length": length=strlen(str);
From there, the middle character is located at the halfway point in the array. So, if you had an integer variable called "halfpos", then this assignment would place the middle position of the string in "halfpos": halfpos=length/2;
Note that strings with an even number of character (2, 4, 6, 8, 10, etc.) actually have two middle characters. So "halfpos" would actually contain one character less than what's considered the "middle" of the string. Examples of this are:
- "Grape" contains five characters, ranged 0 to 4, so "halfpos" is 2, or "a" - although 5/2 is 2.5, because "length" and "halfpos" are integers that .5 is stripped off.
- "Tomato" contains six characters, ranged 0 to 5, so "halfpos" would be the point between the "m" and the "a".
To write the code for this exercise, you will need to know more about arrays. See the related links below for more help.
If you are using an array : sort using qsort() then take middle element.
hey..it s simple..make use of built-in function isdigit(character)..it s in stdlib.h...
write a vb program to find the magic square
Write a program to find the grade obtained by the students of a class
helicopter
If you are using an array : sort using qsort() then take middle element.
hey..it s simple..make use of built-in function isdigit(character)..it s in stdlib.h...
write a vb program to find the magic square
For first find an example program.
Write a program to find the grade obtained by the students of a class
Yes, do write. That's what you always have to do when you have got a homework-program.
yes you can find it opsdsdsd.com
write an assembly language program to find sum of N numbers
helicopter
Write a c program to compute the surface area and volume of a cube
program to find maximum of two numbers using pointers
bgfygfrhjyuyhh