Questions tagged [arrayofstring]
51 questions
0
votes
0 answers
Problem printing characters and creating a new string array
I have created a program that loads an expression from an input file and converts the expression from infix to postfix form.
So in the file I have expressions. Each expression is placed on a separate line in the text file.
I read from the file line…

Andew Tayloe
- 15
- 3
0
votes
2 answers
How do I count the number of words with the same length in a array of strings C
I'm opening and reading a dictionary file and counting how many words are in the file. Then I'm storing each word individually in an array of strings. After that, I sorted the words by length and in alphabetical order, using the funtion qsort().…

Userdsnv17
- 5
- 2
0
votes
2 answers
Assign an integer to a single element string array in C
I cannot figure out how to assign an integer value to an array of string in C, assuming this is possible of course! I would like to change some elements from a char ** into different values and then re-assign them to their initial position into the…

Gipsy
- 61
- 4
0
votes
1 answer
Passing array of strings as an input argument in a function
I'm new to C and I'm not to sure if the title of the question is correct with what I'm about to ask here. Basically I have written a bit of code to:
Ask for the user input for a string each time and fill up the array of string.
Sort the array of…

dtrinh
- 69
- 5
0
votes
0 answers
Making array of strings in C
I need to create a string of arrays from a string input in different iterations. This string of arrays will be passed to a separate function in each iteration. The string input will be of the form 'A a,b,c,d,e,f,g,h' , basically 'A' followed by 8…

Nimish
- 5
- 3
0
votes
1 answer
Searching an array of strings, getting weird return
I am doing a school project to search through an array of strings, where the user enters some characters to search through the array, and is displayed the full name and number that includes those characters. This is working, but when I ask if user…

kirk
- 3
- 2
0
votes
1 answer
C segmentation error when changing A string in array
I have this array of pointers to strings which is defined as public above the Main function:
char *Code[]={"MAIN: add r3, LIST",
"LOOP: prn #48",
"lea STR, r6",
"inc r6",
"mov r3, K",
…

Roy Shiff
- 63
- 7
0
votes
1 answer
2D array of pointers
I'm working an application which required the below thinngs.
const char List1[2][10] = {"Stack","Overflow"};
const char List2[2][10] = {"Goo","Gle"};
const char List3[2][10] = {"Face","Book"};
const char List4[2][10] = {"Pizza","Hutt"};
Now I've to…

Jai Desai
- 27
- 6
0
votes
1 answer
Can I take a word out of Array of strings?
I am writing the following string in the main function:
char* dict[] = { "ball", "aba", "bla" };
My question is:
Am I able to take a whole word out of this string?
For example, if I want to copy the whole word, can I do something like this:
str[j] =…

Omer Zohar
- 27
- 2
0
votes
1 answer
dynamic array of strings, but i get heap corruption detected
I try to make a dynamic array of char pointer, what means does pointers can be a dynamic memory too, so in the code above I try to allocate one size to the array and in him, allocate to the first object a string. But I get an error "heap corruption…

Artur Karabekov
- 17
- 3
0
votes
1 answer
Array of pointers for string while reading file in C
I want to read a file and store each line in the array of pointer. The file has 4 lines and each line has 4 characters. I read each line with using fgets and assign the line to my array of pointer. While assignmentation I can write the line…

Ali Haydar Kurban
- 38
- 3
0
votes
1 answer
Error when passing multidimensional char array to a void function in C
I'm passing a multidimensional array to the function "read_line" but what I'm getting back is only 1D-array, see the code below. What "read_line" do is read the sentence and save every word as an single string in the 2D-array, but when I try to…

SaifSa
- 15
- 5
0
votes
1 answer
Given a string, find out if it satisfies the IPv4 address naming rules (code review) not looking for another solution
An IP address is a numerical label assigned to each device (e.g., computer, printer) participating in a computer network that uses the Internet Protocol for communication. There are two versions of the Internet protocol, and thus two versions of…

ra_pri
- 155
- 2
- 4
- 20
0
votes
1 answer
Taking Input From User In Array Of String in java
Following is my code snippet and I'm getting on last line on loop.
public static void main(String[] args) {
String [] name = new String [5];
Scanner get = new Scanner (System.in);
for (int i=0; i

Furqan Anwar
- 45
- 5
0
votes
0 answers
string in shared memory becoming blank
I have created an array of strings in struct and it is shared.
the struct is as following :
struct data{
int uids[5];
int sockids[5];
int stat[30];
char msgs[30][1024];
};
this is the writing part and i can see the string on…

Ashwin Bhoyar
- 3
- 1
- 3