All Questions
Tagged with c-strings multidimensional-array
69 questions
-2
votes
3
answers
122
views
Insert Sort with Strings in C [closed]
I'm trying to make a insert sort with strings. That's my code below.
#include <stdio.h>
#include <string.h>
#define MAXLINES 5
#define MAXLINEC 1000
int
main(void)
{
char lines[...
1
vote
3
answers
76
views
Separating a long string into individual words in C
What I'm trying to do is, given a string (say "This is a string") write a code that could take it and put each word in a separate element of an array ("This", "is", "...
2
votes
2
answers
701
views
Subscripted value is neither array nor pointer nor vector. Taking input of n strings using struct in C
The question states that I take input from the user to enter n number of names using structures in C. I have written the following code:
#include<stdio.h>
typedef struct employee{
int code; ...
-1
votes
3
answers
112
views
Adding/appending string into an array of strings
Let's say I have an array that looks like:
char arr[MAX_ARR_LENGTH][30] = {"Tom", "and", "Jerry" };
Now, how do I append a new string that the end of the array? Let's ...
1
vote
2
answers
65
views
how do I access a character from 2-D char string
#include <stdio.h>
#include <string.h>
#define max 50
#define len 30
char text[max][len];
void main(){
register int i;
printf("Enter an empty line to quit\n");
for(i =...
0
votes
1
answer
220
views
C loop to get strings and store them in 2D array
I created a multi-dim array to store (name/fname/code) of multiple students in (row 0) it stores the (name/fname/code) of the first student then it passes to the next row (row 1) --> (name/fname/...
1
vote
3
answers
73
views
C Language: I try passing 2d string to function and need to use pointer, but it shows the warning
I'm a university student. and the teacher wants me to pass multiple strings to function. The answer output is correct but I wonder what the warning is why it shows and how to fix it in my case.
I try ...
0
votes
3
answers
1k
views
C How to create an 2d array of characters? [duplicate]
So would like to create an 2D array of characters for testing purposes. Here is my code.
const int rows = 4;
const int columns = 6;
//char field[rows][columns];
//fill_field(rows,...
0
votes
1
answer
172
views
dynamically create a 2d array of strings
i'm new to C and whilst working on a problem i'm struggling to dynamically create a 2d array of string values that i can access like things[i][j]. so far i can create a 1 d array of strings and access ...
1
vote
1
answer
49
views
How to use a stack(array) for strings instead of characters or integers in c?
#include <stdio.h>
#include<string.h>
int top = -1, n;
char stk[25][25];
int stackempty()
{
if ( top == -1 )
{
return 1;
}
else
{
return 0;
}
}
...
2
votes
3
answers
170
views
scanf() not writing to 2d char array
I am working through a textbook teaching myself C programming using the Code::Blocks v20.03 IDE.
I am really bamboozled by a small program that is to read in three small strings into a 2d char array ...
-1
votes
2
answers
1k
views
How to initialize a 2d array in C
I am trying to figure out a way to initialize my 2d string array and Iwanted to know if there is a better way of doing it than what I have coded below.
Is there also a way to not provide the size of ...
2
votes
3
answers
629
views
using C copy a 1D char array into 2D char array
I am trying to copy a 1D array of Strings into a 2D array of strings in C.
I was able to achieve this with integer
enter image description here
//Here is what I tried for integers.
int main()
...
1
vote
2
answers
51
views
error request for member .. in .. which is of non-class type - C++
I have got this error: "error: request for member 'nume' in 'tablou[j]', which is of non-class type ' [100]'", and I don't really know how to solve it.I tried searching on youtube and google ...
1
vote
2
answers
932
views
Count vowels in each of the strings using two dimensional array
I need to write a program where the user enters the number of strings and the program counts the number of vowels in each string and prints the total number of vowels.
The following code works without ...