C/C++ :: Clear First Character Of Array
Mar 26, 2014
I am trying to clear the first character of my array. The first two methods don't seem to work. The third method seems to but doesn't look like a good idea.
char operand[] = "abc";
//both methods seem to null it out
operand[0] = 0;
memset(operand, 0, 1);
printf("%s", operand);
//seems to work
memset(operand, 5, 1);
View 4 Replies
Feb 5, 2013
How to clear data from a char array?
View 19 Replies
View Related
Jul 4, 2014
Can we do this :
Code:
char strings[][100]={"ABC","EFG","IJK","LKM"};
char temp[100];
temp=strings[1];
View 3 Replies
View Related
Jun 14, 2013
The program should store a character array in reverse order then display the reversed array. I have also included in the code that will display the actual characters into the array as it loops through. So I know the characters are being stored, but why doesn't it display the entire string when I call it?
Code:
#include<stdio.h>
int main(){
char str[50];
char rev[50];
printf("Enter Desired Text: ");
scanf ("%[^
[Code] ....
Is it just my compiler?
View 5 Replies
View Related
Apr 16, 2014
I am currently having an issue with validating user input for a state abbreviation. I have an array where a list of abbreviations is stored to use as a comparison for whatever the user inputs. I have been able to get the list loaded properly but whenever i go to compare, it always comes back as true even if it isn't. Here is some relevant code:
static char stateTable[STATE_TABLE_SIZE][STATE_SIZE];
int main() {
char buffer[40], *testCustName[40], testState[5], testCode;
buffer[0] = '