beyonds this I don't understand how to do it
#include<stdio.h>
int main ()
{
int i = 0;
int Digits[ ] = {1, 1, 1, 1, 1, 3, 4, 4, 4};
Type: Posts; User: Rahul11
beyonds this I don't understand how to do it
#include<stdio.h>
int main ()
{
int i = 0;
int Digits[ ] = {1, 1, 1, 1, 1, 3, 4, 4, 4};
#include<stdio.h>
int main ()
{
int Digits[ ] = {1, 1, 1, 2, 2, 3, 4, 4, 4};
int current, previous, i;
int count1;
previous = Digits[0];
How to do with second approach ?
previous = 1
current = 1
bothe are same count1 = 1
previous = 1
current = 1
I need to count as long as the value of digit remain same. I don't understand how to implement this in programming
I am trying to write c program to find duplicate digit's in array
something look's like this
Digits = [ 1, 1, 1, 2, 2, 3, 3, 3, 4, 5, 5 ]
Digit 1 display 3 times
Digit 2 display 2 times ...
Thanks to all for showing different approach
we assume that first number in the array is smallest number. That's why we are not comparing. It's not good idea to compare same number in twice
...
I am trying to find smallest number for every given sequence
Here is program I wrote but it is not showing me the as I want
I am stuck with function
#include <stdio.h>
void...
I am surprised because I am accessing a variable x that is declared in another source file file1.c without extern
main.c
#include <stdio.h>
#include "file1.h"
int main() {
x = 6;
I have declared variable x in main.c file. I want to access this variable in another file FileA.c. That's why i used extern storage class
#include <stdio.h>
extern int x;
int main...
I am wondering how program is showing correct output without external storage external class in source files because I have two source file
main.c
#include <stdio.h>
void fun ();
...
I wrote code for linked list and drawn diagram for list to show behavior. I just want to verify that description shown in picture match with code. Does it really match ?
...
Revised code
#include <stdio.h>
#include <stdlib.h>
struct Node {
int data;
struct Node *next;
};
I know what is double pointer but I don't understand how double used in linked list
In this example I have pointer P that point to first member of list. All the memory location are temporary
...
I've seen many example of linked list in which double pointer is used in a function to add the node in list
void addNodetoList(struct Node **node, int x)
{
//additional code //
}
one int variable occupy 4 byte and one char variable occupy 1 byte. In my code I store one int and char variable using structure
#include <stdio.h>
struct S
{
int x;
char y;
}s1;
Really I made silly mistake I didn't notice this is happening because of the format specifier
I have written three programs first two program are working as it supposed to do but i don't understand what's happening in last program
Program 1
#include<stdio.h>
#define value 'A'
List content
1
2
3
#include <stdio.h>
#include <stdlib.h>
I completely understand pointer, dynamic memory allocation and structure. I am only having trouble to pass pointer to structure in function, to return pointer in function, to pass double pointer to...
The idea was to test the code that pass dynamically allocated double pointer to structure type struct to function
so far I wrote and tested code that pass pass dynamically allocated pointer to...
I found below function on this page Linked List | Set 2 (Inserting a node) - GeeksforGeeks I don't how its working
double pointer of structure being passed to this function
/* Given a...
I want to modify the value of structure member without modifying actual address. I have written function but It doesn't works as expected
#include<stdio.h>
#include<stdlib.h>
typedef...
#include<stdio.h>#include<stdlib.h>
typedef struct{
int var1;
int var2;
} svar;
I am trying to figure out Where does structure variable store and what does it store using printf statement
I have written this code
#include<stdio.h>#include<stdlib.h>
typedef struct{
Thank you laserlight for answering my question