Can you post your code here?
Type: Posts; User: sana.iitkgp
Can you post your code here?
My apologies. I was wrong.
When i tried to debug with gdb, segmentation fault occured in removestring().
Your "findString" is not working as expected. It is returning a -ve number. Fix that function.
You said int is 2 Bytes i.e 16 bits. So you can represent 65536 values with int both positive and negative. That range is -32768 to 32767. If any number which is not in that range you cannot...
Ok, then int can have values form -32768 to 32767(16 bits signed). Your result is not in this range show it is giving as '0'.
Can you explain this?
If integer is 32 bit then expected is "4 -2147483648".
INT_MIN is the minimum integer that can be represented by the int data type.
It depends on the number of bits for int and whether it is signed/unsigned.
For x=-4 and y=5 it is working fine for me.
It's working fine
Try this
int xy=arr[i].var1;
The main function compiled. It is giving segmentation fault because of the last for loop, as it is accesing the memory beyond it allocated.
# cc -Wall cpb22.c
cpb22.c: In function āmainā:...
I misunderstood the question.
This should solve your problem.
#include <ctype.h>
#include <stdio.h>
#include <string.h>
int
main(void)
Hey, I debugged your code, there are some flaws in your code. This code is working fine. You can check the differences.
#include <ctype.h>
#include <stdio.h>
#include <string.h>int...
.file "cpb19.c"
.section .rodata
.LC0:
.string "%d"
.text
.globl main
.type main, @function
main:
leal 4(%esp), %ecx
andl ...
for (a=0;a<(rgn);a++)
{
printf("%d ",store[i]);
i++;
}
This is wrong as alredy i is greater than rgn, it won't print the sorted array.
Sorting is working fine.
Why are you declaring all the arrays as 2-D arrays?
#include <stdio.h>
#include <string.h>
int main(void) {
const int TOTAL_TILES = 98;
One more thing,
else ((grade >= 1) && (grade < 70)); {
D = D + 1;
}
This is wrong, because D=D+1 is getting executed every time as you have ';' at the end of else...
In these printf statements you are printing address of A not value of A.
Just remove the '&' before every variable in these printf statements.
You'll get the actual result.
It is giving the correct result. 55+66+77/3=66.
void getdata(char *, char *, char *);
void dispdata(char *, char *, char *);
These two are wrong as your functions take 4 arguments and here you have given only 3.
void dispdata(char...
Try "scanf("%s",&a);"
This will work.
a[30] is a char, not a string. One more thing you should keep in mind is when you are working with scanf you have to provide the address of variable not the...
First you should try. If you find any difficulties, you need to ask here.
scanf("%d",&a);
This will solve your problem.
Remainder of sum of digits divided by 3 is either '0','1','2'. In the above case it is '1'. So if any of your digits is '1' or '4' or '7' you can directly remove them, otherwise you need to remove...
Instead of strcpy() you can just do this new->data=string.
However there is a flaw in your logic. Find that flaw.
this is the output ::
# ./a.out
Enter a string: abcd
Enter a string: 2erf...