Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
1 vote
2 answers
109 views

Why doesn't `char` lose data when an `int` is being assigned to it?

I'm a novice C programmer. I defined two variables int x = 0xffffffff and char y = x, thereafter I printed that using the printf("%x\n", y) function; I was expecting something like ff on the ...
Greeshma's user avatar
0 votes
1 answer
96 views

Adding elements into a char array

I've been trying to make a function in C that takes a string as the input and then prints out a version of that string that only contains alpha characters. #include <string.h> #include <ctype....
Lushana Elie's user avatar
3 votes
2 answers
70 views

fwscanf failing to read UTF-8 CSV file correctly in C

This program can only use libraries of the C standard. I'm trying to read a UTF-8 encoded CSV file in C using fwscanf, but I'm encountering issues with the reading process. The file contains rows with ...
iPc's user avatar
  • 53
0 votes
0 answers
57 views

Italian Text Frequency Analyzer: Handling Special Characters and Accents

The program works well overall; however, it encounters an issue when it processes accented words. When the program encounters words with accented characters, it stops functioning correctly. The exact ...
iPc's user avatar
  • 53
0 votes
3 answers
157 views

can you typecast an int into 4 chars using structs?

this is my idea: int main(){ struct mystruct { char a; char b; char c; char d; }; struct mystruct structinstance; //1094795585 is in binary: 01000001 01000001 01000001 01000001 -to ...
bangingmyheadontable's user avatar
3 votes
3 answers
99 views

How can I make char string array in C have dynamic size?

C language I'm writing a function that relies later on on generating some text that has to hold the length of essentially: 115 letters minus the length of substring within <> from the original ...
kerstoff0mega's user avatar
0 votes
1 answer
86 views

why cant i access the location in char pointer array with dereference to int pointer as index

im making a project and i was getting an error out of nowhere supposedly so i went into debug mode and couldn't find the error but the error only occurred in a specific place so i copied the code and ...
neo's user avatar
  • 45
0 votes
0 answers
33 views

Shift char* array to left [duplicate]

This is my code #include <stdio.h> #include <stdlib.h> #include <string.h> int i, j, k; int arr_size = 5; char* data[] = {"1234567", "1234576", "1234756&...
Torokh's user avatar
  • 33
0 votes
1 answer
42 views

logic gates codingame struggles

Im new to C and i really need your help Detail: https://www.codingame.com/training/easy/logic-gates All of that works okey (for me), except printf("%c ",output_name[0][i]); My idea is print ...
Blu e's's user avatar
1 vote
2 answers
51 views

I am running a conditional loop to iterate through an Array to validate that the user only entered digits. Error when I make the comparison to NULL

As the title says. I am making a program where it takes in command line argument from the user and it encrypts the message. Before the user enters the message, they are required to make an 'encryption'...
GhostaNero's user avatar
-1 votes
1 answer
84 views

Weird behaviour in C when hex value(over 0x7f) is assigned to (signed) char

When a hex value "0x000000a1" is assigned to (signed) char, char is equal to "0xffffffa1". Can anyone explain this weird behaviour? void main(){ char testVar = 0x000000a1; ...
bangingmyheadontable's user avatar
-4 votes
2 answers
79 views

Escaped backslash (double backslash) in C counting as two bytes in string [closed]

I'm a relatively inexperienced programmer and I'm running into some confusion about escaped backslashes. I'm using strings containing literal backslashes to represent Windows filepaths (for some ...
WyntrHeart's user avatar
2 votes
1 answer
75 views

char * vs unsigned char *

So I was playing around with char* and unsigned char* pointers. And I came across this issue: Code: #include <stdio.h> void func(unsigned int max) { unsigned int* intptr = &max; ...
programk5er's user avatar
1 vote
2 answers
56 views

Value of index randomly changes in dynamic character array during for loop

For one of my assignments in my C book, I have to find a way to treat characters as integers. So, I wrote a program that takes an array of characters that represent integers, add them up, and output ...
AsianDora's user avatar
0 votes
1 answer
104 views

Why does c delete the null character between two char arrays initialized in sequence?

I am learning c. I have the following code: char s1[] = {'h', 'e', 'l', 'l', 'o'}; char s2[] = {'w', 'o', 'r', 'l', 'd'}; printf("Original strings:\n\t%s\n\t%s\n", s1, s2); Whenever I ...
Harrison Rankin's user avatar

15 30 50 per page
1
2 3 4 5
329