character « char « C Array Q&A

Home
C Array Q&A
1.bit
2.Byte
3.char
4.class
5.Development
6.Dimensional Array
7.dynamic
8.element
9.find
10.index
11.initialization
12.Integer
13.length
14.loop
15.memory
16.Operation
17.pointer
18.Print
19.size
20.Sort Search
21.string
22.struct
23.variable
C Array Q&A » char » character 

1. Inputing characters into arrays in C- follow up    stackoverflow.com

This is a follow up question to a previous question I asked about calculating a straight hand..not exactly the same...This is the method to read in cards- it works- but is ...

2. how to put an array character into the equation?    stackoverflow.com

i try to put 8 byte character into the equation causing a lot of error,what i'm supposed to do to make sure the equation can take the static value and produce ...

3. Character Array in C    stackoverflow.com

When we define a character array as 'char name[10]', this indicate that the array 'name' can hold a string of length ten character. But in the program shown below the array ...

4. Is this a bug? Problem getting ASCII characters from an array with ATmega32    stackoverflow.com

I've got an LCD, connected to an Atmega32, working with single characters using this function:

void send_char(uint8_t c){
    PORTD = c; // set the output pins to the ascii ...

5. calling character array in stucture    stackoverflow.com

typedef struct employee
{
    int age;
    char name[30];
} emp_t;

emp_t * e;

int main( )
{
    printf("\nName : ");
    scanf("%s", &e->name);
   ...

6. Can a character array be used as expression for switch statement?    stackoverflow.com

void main()
{
  char name[20];

  printf("\n enter Your Name: ");
  gets(name);

  switch(name)
  {
    default : printf( "Invalid" );
  }

  getch();
}
So may question ...

7. character 1D array    bytes.com

8. using character as array subscript    bytes.com

Hi, What is the best syntax to use a char to index into an array. /////////////////////////////////// For example int data[256]; data['a'] = 1; data['b'] = 1; /////////////////////////////////// gcc is complaining about this syntax, so i am using static cast on the character literal. Is there a better way to do this? Thanks, Ivan

9. Character Arrays in C    bytes.com

10. LPByte to character array    bytes.com

11. displaying address of a character array ?    bytes.com

Wondering Wanderer wrote:[color=blue] > If I declare a character array ( say, char arr[10] ), how do I see the > address of the first element of the array ? simply using cout << arr > or cout << &arr displays the entire string in the array, not the > address.[/color] cout << static_cast(arr); V -- Please remove capital 'A's when ...

12. Character array question    cboard.cprogramming.com

Hello, I was wondering if anyone knew how to display each letter of a character array on a separate line without doing a printf for each one. I made an example in the code below. If I wanted to display 'H' on the 1st line, 'e' on the next, etc., how would I do that? It just displays Hello 5 times ...

13. XOR with character array    cboard.cprogramming.com

14. Arrays - accented characters    cboard.cprogramming.com

It is because you are trying to put characters which aren't in the ASCII-table into a char. Encoding is a headache, look into things like UTF-8, unicode etc. if you want to know more about it. The problem is that is a multibyte char, and can't be represented by a single byte. This is actually a very interesting blog post ...

15. Character Array Help    cboard.cprogramming.com

#include char *myStrCpy(char*, char*); int main() { char string[] = "Mary had a lamb."; char copy[10] = "012345678"; *myStrCpy( copy, string ); printf("%s\n", copy); } char *myStrCpy( char dest[], char source[] ) { int i = 0; while ( source[i] != '\0' ) { dest[i] = source[i]; i++; } dest[i] = '\0'; return dest; }

16. Pointing to the next character in an array?    cboard.cprogramming.com

#include int main () { int myArray[] = {5, 6, 7, 8}; int * myPointer = &myArray[0]; printf("Print address of beginning of array of 4-byte integers:\n"); // print address of myArray[0] printf("&myArray[0]:\t0x%08lx\n", (unsigned long)myPointer); printf("&myArray[0]:\t%p\n", (void*)&myArray[0]); printf("&myArray[0]:\t%p\n", (void*)myPointer); // print address of next element of the array printf("&myArray[1]:\t0x%08lx\n", (unsigned long)(myPointer+1)); printf("&myArray[1]:\t%p\n", ((void*)&myArray[0])+sizeof(int)); printf("&myArray[1]:\t%p\n", ((void*)myPointer)+sizeof(int)); return 0; }

17. How to access individual characters in an array?    cboard.cprogramming.com

18. character array issue    cboard.cprogramming.com

Trying to make a simple tic tac toe game and I'm stumped, something is not working right. The grid is drawn easily, but I can't alter the grid for some reason or printf the proper character after getting input. It's probably something very simple and stupid, but its been a long time since doing any programming. Code: #include /* draw ...

19. loading 2 character arrays in a row    cboard.cprogramming.com

rivkyfried1 Registered User Join Date Aug 2010 Posts 17 loading 2 character arrays in a row I am having a strange problem. I am attempting to load two character arrays in a row. The program then sends one of the arrays to a function called binarysearch. The code looks like this: Code: strcpy (irregverbs[0], "be"); strcpy (irregverbs[1], "bear"); strcpy ( irregverbs ...

20. Character array help    cboard.cprogramming.com

Hi, i am currently trying to write a program that can accept 3 input strings and perform different tasks based upon it. I currently have written a program that will scan what the user inputs and display how many characters have been inputted and also the amount of spaces to differientiate between strings. I have also set a limit to stop ...

21. character array    cboard.cprogramming.com

22. character arrays    cboard.cprogramming.com

23. Basic question on character array    cboard.cprogramming.com

24. want to chk first character in double array    cboard.cprogramming.com

25. erase all characters in a character array?    cboard.cprogramming.com

26. Using a character array in a switch question.    cboard.cprogramming.com

Hi guys, hoping you can help with an assignment I'm working on. I've got most of the program working, but it's just little bits and pieces that need tying up. Basically one part of the program requires the user to enter a character for the corresponding room type - so for a rectangular room, the user would enter R or r, ...

27. Problem using 'if' statment to exclude characters in an array    cboard.cprogramming.com

Yeah sometimes it feels like that. If you are new you get flamed for what you don't know, if you are experienced you get everything you say compared to the most recent C/C++ standard all while your every thought is disected and critiqued by all. You just gotta learn no one has any hard feelings. We just try to keep one ...

28. using character arrays and realloc    cboard.cprogramming.com

29. Question on character arrays    cboard.cprogramming.com

30. Character to array (Noobie Q)    cboard.cprogramming.com

It seems as if someone else on here is doing the exact same assignment as me...haha...well...I have some different problems. If you run this, you see that, after you enter the word, you have to hit 10 times for the next "please enter your ## word" to come up. Its obviously effecting my results if you keep going through the ...

31. Character Arrays    cboard.cprogramming.com

32. Just a quick question about character arrays    cboard.cprogramming.com

33. Help with a character array.    cboard.cprogramming.com

Code: #include void printArray(char a[][2]); void modifyElement(char table[4][2]); void checkArrangement(char table[4][2]); int main() { char table[4][2]={'1','2','3','4','5','6','7','8'}; int counter=1; printArray(table); while(counter<=3){ modifyElement(table); printArray(table); counter=counter+1; } checkArrangement(table[0][0]); return 0; } void printArray(char a[][2]) { int i; int j; printf("\t_____U____\n"); for(i=0;i<=3;i++) { for(j=0;j<=1;j+=2){ printf("\t%c|\t|%c\n",a[i][j],a[i][j+1]); } } printf(" \t----------\n"); } void modifyElement(char table[4][2]) { int seat; int r; int c; char guest, junkChar; printf("In ...

34. A question concerning character arrays    cboard.cprogramming.com

35. character array    cboard.cprogramming.com

Hello all! I am hoping someone can help me with this because my professor wont get back to me(he lacks programming skills, I believe). Anyways, I am supposed to create an array with a user specified amount(between 10 and 30) of random letters to be generated. After the amount of characters has been specifed, the program should send the base address ...

36. Character Array - almost? works    cboard.cprogramming.com

#include #include int exist (char *str, char c) { while (*str++) if (*str == c) return 1; return 0; } void add (char *str, char c,int *tmp) { int i; for (i=0; i<(*tmp); ++i) ; str[i] = c; } int main(void) { char str[100]; char curr; int tmp = 0; while ((curr = getchar()) != '\n') if (!exist(str,curr)) { ...

37. confuse with character array    cboard.cprogramming.com

38. Manipulation of character arrays    cboard.cprogramming.com

I have been having trouble with using arrays of indefinite size. I havent had a problem I think creating an array of unknown size but I have had problems ending the program. I have noticed that others have had similiar problems but I am still unsure as to how I should go about fixing the problem. If I were to calculate ...

39. Resetting a character Array    cboard.cprogramming.com

40. help with character arrays    cboard.cprogramming.com

help with character arrays Hi I've just started to learn c programming at college and I'm having a bit of difficulty in getting my head aroung character arrays.In the program I'm writing I need to be able to display a grid of 11 *11. This is made up with city names and distances. I read these from a text file which ...

41. How can I destroy a character array?    cboard.cprogramming.com

42. Array of Character Arrays    cboard.cprogramming.com

Ok, I am running into a brick wall so time to ask- I have a test driver. Up to this point it runs on one data file, but I wanted to make it able to run a series of tests. So I have made a file that contains the full names of all tests I want to run (e.x. c:\test1 c:\test2) ...

43. array of character    cboard.cprogramming.com

44. Character arrays help please :)    forums.devshed.com

#include #define MAXLINE 1000 /* maximum input line size */ int getline(char line[], int maxline); void copy(char to[], char from[]); /* print longest input line */ int main(void) { int len; /* current line length */ int max; /* maximum length seen so far */ char line[MAXLINE]; /* current input line */ char longest[MAXLINE]; /* longest line saved here */ ...

45. Conceptual problem in character array    forums.devshed.com

Your program's first problem is that it is not being displayed inside of code tags. You can rectify that problem by editting your OP and placing [code] in front of your code listing and [/code] behind your code listing. Please do that now so that we may read your listing. I contest your assertion that your program only gave you 2 ...

46. Putting characters into arrays?    forums.devshed.com

Hey guys, I'm having a little trouble figuring out how to do part of an exercise in my book. The user is supposed to enter in a sentence, in one line, and I'm supposed to printout each word (that is separated by a space) and also printout how many characters each word has. Oh, and it doesn't want us to use ...

47. Really basic question about character arrays.    forums.devshed.com

Quote: Originally Posted by lozware Thank you! Also, what do I use in C++ when I am refering to the NULL character? Do I simply write the word NULL in caps, or lowercase? My teacher writes it '\0' - does that mean it takes up 2 characters, or just 1. First, NULL is a pointer value and it is also called ...

48. Character array help    forums.devshed.com

I want to take a string an add two characters in front of it. It sounded pretty simple, but I seem to have forgoten how to move a pointer to an array back and forth through its indeces. I think all I need to do is have two arrays. One with the string, and the other one with nothing in it ...

49. Character array problem.....    forums.devshed.com

Hi... I have some problem here.. hopefully somebody could help me... Actually i want to read some input as below :- Sequenced Value 100 123ABC 101 BVF122 102 KJNG098 103 C123XXX then stored into memory... then at the last of the program, I want to print out the Value based on Sequenced input. As example :- -> print C123XXX if the ...

50. Character array help.    forums.devshed.com

hi there! i have a function that retrieve data from a data base. then all of the retrieve data is then converted to a string (character array ) of data. i don't have any control on how many rows of data are retrieve from the data, so the problem is basically there is not enough space (don't know if this is ...

51. Character Array problem building a Database    forums.devshed.com

I am not an expert C/C++ programmer, and am having a bit of a problem on a school assignment. The assignment is to build a text file based database. The program has to read a schema file containing information about the individual tables (table name, filename, data field name, type, and length). Then it must be able to read the data ...

52. trouble with character arrays    forums.devshed.com

Hi Im having trouble with the following code/pseudo code and wondered if anyone can help. I need to take a binary message e.g. "10101010111111111111111" and split it into further binary messages such that each split binary message has 1 character less than some other binary message n. So for example if... b = 10101111000010101100 ie 20bits n = 10111 ie 5bits ...

53. character array question    forums.devshed.com

Yes, they can, as in: Code: char myCstring [] = "This is it"; This is a special case. The compiler finds memory for the array, initializes it, and gives you a pointer (myCstring) to it, thus satisfying the demand for a valid pair. Normally, the contents are not writable, they're const. For a writable string, do thusly: Code: char myCstring [someNumberHere] ...

54. Trouble with character arrays    forums.devshed.com

I'm having a brain freeze here, could someone help me out? I have the following code in a function Code: void name(Player sorter[], int count) { bool swap; char templast[50]; char tempfirst[50]; char temppos; int tempnum, tempreb, tempass, temppo; do { swap = false; for (int number = 0; number < (count - 1); number++) { if (strcmp(sorter[count].lastname, sorter[count + 1].lastname) ...

55. Bringing 2 character arrays into one?    forums.devshed.com

in the following code, i am stuck and confused about how to bring 2 character arrays into one. what i want to happen, is for this registry path "Software\\America Online\\AOL Instant Messenger (TM)\\CurrentVersion\\Users" to have things added on to it, so it will be like... "Software\\America Online\\AOL Instant Messenger (TM)\\CurrentVersion\\Users\\SomeuserName" "Software\\America Online\\AOL Instant Messenger (TM)\\CurrentVersion\\Users\\TheNextUserName" etc.. please check out my getNumberAIMHashes() ...

56. defining array of characters    forums.devshed.com

I assume you're using C, so the answer is no. Your best bet is realloc. The code will be something like this. { int maxsize = 10; int currsize = 0; char *x = calloc(size, sizeof(char)); while(input) { if(currsize==maxsize) { maxsize = maxsize * 2; x = realloc(maxsize, sizeof(char)); } // Get the next char currsize++; } something like that should ...

57. Character array in C    forums.devshed.com

I have a character array RIB which is a part of a structure REL that is typedef struct { char JUNK[17], char RIB[3] } REL In my code I have an instance (maybe it is wrong to use that word in C but I come from a Java background) REL rel; Now I want to print the the first character of ...

58. Character Array    daniweb.com

and you asked me about the index value in for loop: i use "j=name[i];" the reason is if you give "j=0; then it will print whatever i scanf as you say will print from 0 to name[i] (40 times or 50 time) i the the limit of my character array. thanks again

59. Character Array    daniweb.com

I' working on an array where the user inputs characters(up to 80). I then need to output the characters, one per line, until the string is null. My problem is in the while loop i think, im just not sure what to do from here. Any ideas? 1. #include 2. void main() 3. { 4. char chararray[80]; 5. int n ...

60. Help with folding a character array please    daniweb.com

/***** required macros and structures *****************/ union example { char array[6]; struct ints { short a; short b; short c; }x; }; union example e1; #define swapbytes(z) (((short)(z << 8)) | ((short)(z >> 8))) /********************example code snippet ****************/ int main(int argc, char* argv[]) { memcpy(e1.array,"aBCDEF",6); printf ("value of array = %s\n",e1.array); printf("value of a = %X\n",swapbytes(e1.x.a)); printf("value of b = %X\n",swapbytes(e1.x.b)); ...

61. Is this possible to work with character arrays with Template Metaprogramming?    codeproject.com

I am wondering if I can compute a one-to-one mapping from a series of types to characters using metaprogramming. I currently have a template with a list of types such as T1, T2, ..., T15. My code fills a character array with I-th position filled based on the I-th type. I am wondering if I can compute the character array at ...

62. breaking up a character array    tek-tips.com

I have a 1-D character array of over 64,000 bytes. I want to break this array into a 3-D character array. Each element would be 32bits(4bytes). What would be the easiest way to do this?The original character array is the character representation of a 32-bit per pixel bitmap image. The information for each 32-bit pixel is just ...

63. Changing Character Array Content    tek-tips.com

Hello,Disclaimer: I am trying to do this for a homework assignment, so please do not outright tell me how to code my solution.I have been tasked by my instructor to write a function that compares string1 with string2. I am to take out of string1 whatever is not in string2.Noting the various functions in the string.h library, I could not ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.