15,540 Topics

Member Avatar for
Member Avatar for Adm666

why at line 12, the expression : (char*)str+3 , adds the 2nd index to the string? for example when str="123123" , (char*)str+3 is "3123" instead of "123" ? input: 3 0 3 123123 output supposed to be: "Mybcmp result: 0" since the 3 indexes that's compared from b1="123123" and b2="123" …

Member Avatar for Ren C
0
424
Member Avatar for Adm666

just as the title says how to compare between memory addresses's contents?, my function will get two memory pointers and i want to compare their first "len" from what they're pointing to i'm getting here invalid use of void * when i compile int my_bcmp (const void *r1, const void …

Member Avatar for rproffitt
0
491
Member Avatar for jigar_2

I have 300+ files and I am reading it via C program...i am able to compile but what should I pass while executing C program...below is my code...i am bit new to the C ... int i; FILE *in; FILE *out; char ifile[100],ofile[100]; main() { for (i = 0; i …

Member Avatar for Schol-R-LEA
0
278
Member Avatar for S21710491
Member Avatar for Andrew_46

I'm trying to convert the following C code to MIPS64 (very new to this): If Im given the addresses: (a @ 100) (b @ 200) (c @ 300) long int a, b, c; // 64-bit ... if (a < b || a == 4) c = 1; else c = …

Member Avatar for Schol-R-LEA
0
3K
Member Avatar for Hamsterking

hello coders, i hope you all are going well, one thing blows my mind today in c i can't explain it this is why title is akward, so the thing is i have an array called tab[n] i wanted to invert it elements from tab[0] to tab[n-1] and and the …

Member Avatar for Hamsterking
0
464
Member Avatar for Densino

Hi all... I've been asked to write a password generator in C for a project. the guidelines are very vague and all I've been told is: Password must be 9-15 characters long at least 2 numbers 2 upper/2 lower case latters 1 symbol and I need to write a dictionary …

Member Avatar for Schol-R-LEA
0
6K
Member Avatar for noxel8008

Hello guys, im new to c and structures and try to build or atleast fix my programm. I want build something like a digital phonebook. I also want to show my structure attributes after writing them. With my first code is working so far but if i want to show …

Member Avatar for tinstaafl
0
336
Member Avatar for Kang_1
Member Avatar for Jose_17

int add(int i, int j) { if (i == 0) return j; else return add(--i, ++j); } Need to convert this piece of code to something like this add $s0, $s1, $s2 # $s0 = g + h add $s1, $s3, $s4 # $s1 = i + j sub $s0, …

Member Avatar for Schol-R-LEA
0
324
Member Avatar for R1S8K

I have a problem shifting data to specific locations in a 64-bit register. I've done well in 32-bit register. But this one gives a warning and also not shifting the data to the wanted location. This one would work with shifts 0, 8, 16 and 24 but not with 32 …

Member Avatar for nullptr
0
260
Member Avatar for John_189

I do non know how to call my getdaycode function correctly into my main function. Also, when that isn't the problem, the day showing up below header and it messes with the ordering of the days messing up the calendar. Those are my two big problems at this point, I …

Member Avatar for Reverend Jim
1
436
Member Avatar for Iuliana_1

To be calculated with the accuracy of the term that after the absolute value is less than the size of 10^-5 on the interval [a,b] with step h , sum of the series 1-X^2/2!+X^4/4!-x^6/6!+x^8/8!-x^10/10! ... in C Interval [a,b] : [Pi/ 12; 11Pi / 12] Function: cosx

Member Avatar for Reverend Jim
0
151
Member Avatar for mohammed_46

:menu echo 1) start echo 2) intro echo 3) exit set /p menu= if %menu% == 1 goto game if %menu% == 2 goto help if %menu% == 3 exit :help cls echo hit the correct answer and press enter. pause :game echo what is your name? set /p name= …

0
145
Member Avatar for bobby_6

Hi all, How would I read a bin file(which contents are attached below), and then from that bin file create an html file with a table of that bin files content(html format is attached as well)

0
160
Member Avatar for JohnMcPherson

Hello, my name is John McPherson, and I write C code for the U.S. Department of Labor. I am in the process of converting C code for a lot states from a 32-bit system to a 64-bit system. Some states have been converted, and most have gone smoothly, but one …

Member Avatar for JohnMcPherson
0
786
Member Avatar for munitjsr2

[CODE] #include <stdio.h> #include <stdlib.h> typedef struct filedata { char data[100]; }data_t; data_t * fname=NULL; //IS AN ARRAY OF the structure filedata REQUIRED HERE void quit() { printf("\nPress enter to exit"); fflush(stdin); getchar(); } int main() { char ch; fname=(data_t *)malloc(sizeof(data_t)); FILE *fptr=NULL; atexit(quit); printf("Please enter the file name to …

Member Avatar for AssertNull
0
3K
Member Avatar for Stefano_2

i have a file .txt with some variables printed for a c program. Precedente lettura: 7129.00 m3 Attuale lettura: 7288.00 m3 Totale Generale: 159.00 m3 Lettura Carmen: 2597.00 m3 Consumo Carmen: 72.00 m3 Lettura Coppola: 487.00 m3 Consumo Coppola: 47.00 m3 Lettura Sarli: 1903.00 m3 Consumo Sarli: 37.00 m3 Eccedenza: …

Member Avatar for rproffitt
0
252
Member Avatar for i dont know

Hello all, i need your help regaring this code, which is in python and i need to convert it into mips?? register $s0 holds the base address of list my_data, $s1 holds the length of the list my_data, register $s2 holds the base address of list my_data2 and $s3 holds …

Member Avatar for rproffitt
-1
3K
Member Avatar for Taufiq_1

#include <stdio.h> void main() { char str[10], str1[10]; system("COLOR 74"); system("title Password Change "); system("mode con: cols=140 lines=30"); printf("\n\nWelcome to 'Jubayer IT Solution' Refresher'in C Programming App!!"); printf("\n\nType Your Desired Name and Hit 'Enter' Key to Create a New User!!\n\n>>"); scanf("%s",str); printf("\n\nType Your Desired Password and Hit 'Enter' Key to …

Member Avatar for rproffitt
0
352
Member Avatar for Incubator

For all the above functions i get "`*****' was not declared in this scope". I searched days for an answer to find out what am i doing wrong, and what do i have to do to make it work, but all i could find, peaople saying: it depends on the …

Member Avatar for Emre_4
0
2K
Member Avatar for Chef Boyardee

I've been studying the [XEmbed protocol specification](https://standards.freedesktop.org/xembed-spec/xembed-spec-latest.html#lifecycle), as well as [Gtk reference manual](https://developer.gnome.org/gtk3/stable/GtkSocket.html), but I'm having some difficulty. I'm using Gtk+ 3. I've created a Gtk socket, got its window ID, but that's where I'm stuck. I'm using C. If I understand this correctly, the program I'm writing that contains …

0
170
Member Avatar for Waheeda_1

I have an urgent assignment. It would be so great if anyone could help me with the codes of this as I am not able to understand this: Here's the question: Enumerations make it possible to define a new type that contains a limited number of values e.g. the TokenType …

Member Avatar for rproffitt
0
319
Member Avatar for Mooyeon

I'm about to make code that read the text file line by line, then store it to stucture, then use quicksort. But my code doesn't print anything. Here is my code and text file. #include <stdio.h> #include <stdbool.h> #include <string.h> #include <stdlib.h> struct city{ char nation[2]; char region[10]; char name[50]; …

Member Avatar for AssertNull
0
386
Member Avatar for COKEDUDE

I am trying to a % in a printf statement represent 10%. How do I do that? My compiler warnings are complaining about it. I tried a backslash but that didn't work. printf(" 10\% of people \n");

Member Avatar for nullptr
0
142
Member Avatar for Chef Boyardee

Hello, this is my first post here. I'm playing around with Gtk+ and Xlib. I'm trying to get the X window ID of the active window, and then display that ID in a Gtk label. However, when I run it, it seg faults. I've narrowed it down to `XGetInputFocus`, but …

Member Avatar for Chef Boyardee
0
634
Member Avatar for COKEDUDE

Whats the best way to removes values from array of strings? Is it better to create a new array of strings or is there some way to remove them?

Member Avatar for AssertNull
0
400
Member Avatar for COKEDUDE

Why does order matter with this if else if statement? if((row1 = mysql_fetch_row(result1)) && adding_to_member_flag != 1) { printf("Do not update date since it already exists\n"); } else if(!(row1 = mysql_fetch_row(result1)) && adding_to_member_flag != 1) { printf("Update end_date and add new team\n"); } When I had it like this the …

Member Avatar for AssertNull
0
416
Member Avatar for COKEDUDE

My second while condition is being ignored and I don't understand why. I would think I have 1 and 0 = 0 so it would break out. while(fgets(line, sizeof line, stdin) && sscanf_counter != 2) { }

Member Avatar for rubberman
0
263
Member Avatar for COKEDUDE

I am trying to print my data in columns. For some reason every column but the last one lines up. Is there a way to fix this? while ((row = mysql_fetch_row(result))) { //printf("198\n"); for(int i = 0; i < num_fields; i++) { //printf("----------\n"); printf("%25s ",row[i]); if(row[i] == NULL) { printf("No …

Member Avatar for cereal
0
250

The End.