# Search:

Type: Posts; User: Athul

Page 1 of 2 1

1. ## Thread: Some basic doubts in pointer arithmetic

by Athul
Replies
1
Views
437

### Some basic doubts in pointer arithmetic

Hello,

I'm learning one embedded system course online, and while watching one of those video, I had some doubts about pointer arithmetic,

while I was searching for answers I came across this...
2. ## Thread: Understanding bresenham's line algorithm to move stepper motors

by Athul
Replies
1
Views
1,331

### Understanding bresenham's line algorithm to move stepper motors

Hello
I have been trying to understand the code used in GcodeCNCDemo4AxisRAMPS, especially the algorithm used to draw a line. I have been reading several articles on Bresenham's line algorithm....
3. ## Thread: Compiler optimization: volatile

by Athul
Replies
3
Views
617

### How come? here a is changing inside. So how could...

How come? here a is changing inside. So how could compiler ignore it.

Like when counter value reaches til a certain value?

eg:

if TCINT is a counter
4. ## Thread: Compiler optimization: volatile

by Athul
Replies
3
Views
617

### Compiler optimization: volatile

Hello,
I have some doubts about compiler optimizing C code. This is more related to the field of embedded system.

int a, b;

void experiment() {
a = 8;
b = a * 7;
5. ## Thread: initializer element is not constant

by Athul
Replies
6
Views
3,392

### But the following code works ...

But the following code works

#include<stdio.h>

int a = 10, b = 20, c = 50, i;

int *arrop[3] = {&a, &b, &c};
6. ## Thread: initializer element is not constant

by Athul
Replies
6
Views
3,392

### SO how can I make above program work if it's...

SO how can I make above program work if it's global. I tied putting const before array

const int *arrop[3] = {p, &b, &c};

Where can I find more details about it?
7. ## Thread: initializer element is not constant

by Athul
Replies
6
Views
3,392

### initializer element is not constant

Hello,

When an array pointers created inside the main, program works. But when I intialize array of pointers outside main, compiler gives error as

Initializer element is not constant

This...

by Athul
Replies
6
Views
561

### In coming videos, he's using this method. I tried...

In coming videos, he's using this method. I tried that code. But first variable is some junk value. I tried to understand his code by makeing a spreadsheet and trying to poin to various address,...

by Athul
Replies
6
Views
561

This is the link to the video.

Like I said further videos in this series make use of this tutorial

by Athul
Replies
6
Views
561

### Creating a Queue using Double Linklist

Hello.

I'm learning about creating a queue using double link list using a video tutorial. I wrote this code as seen in the video. I don't have the source file shown in the video. I checked the...

by Athul
Replies
5
Views
452

### So when I assign memory using malloc(). they are...

So when I assign memory using malloc(). they are placed in read and write memory, right??
12. ## Thread: Difference between Int *p and int *p = &a

by Athul
Replies
4
Views
587

### So to sum up When do as follows int *p =...

So to sum up

When do as follows

int *p = 5;

here value 5 is treated as an address

by Athul
Replies
5
Views
452

### Here I'm assigning s to "Hello" char *s =...

Here I'm assigning s to "Hello"

char *s = "Hello";
s[0] = '0';

But this crashes program too

by Athul
Replies
5
Views
452

### Initializing malloc()

Why doing something like this okay

char *s;
s = (char *)malloc(100);
s[0] = 0;

but this crashes my program
15. ## Thread: Assigning value to structure members using -> operator

by Athul
Replies
8
Views
568

### This is &(ptr + i)->age in fact same as this...

This is &(ptr + i)->age in fact same as this &((ptr + i)->age)

That makes sense

Thanks
16. ## Thread: Difference between Int *p and int *p = &a

by Athul
Replies
4
Views
587

### Thanks for the reply Does this mean, ...

Does this mean,

Int *p = 7

here 7 is treated as address, not as value??
17. ## Thread: Difference between Int *p and int *p = &a

by Athul
Replies
4
Views
587

### Difference between Int *p and int *p = &a

Hello,

Some way the pointers are used confuses me.

When use as below

int a = 5;
int *p = &a;
18. ## Thread: Array of structure: Structure members are enum varaibles

by Athul
Replies
1
Views
472

### Array of structure: Structure members are enum varaibles

#include <stdio.h>

typedef enum {
GREEN = 0,
BLUE
}COLOR;

typedef struct{
19. ## Thread: function as structure variable

by Athul
Replies
2
Views
322

### So just like creating a structure variable we can...

So just like creating a structure variable we can create a function that return a structure.

Can you show a simple example to me??
20. ## Thread: function as structure variable

by Athul
Replies
2
Views
322

### function as structure variable

Hello,

I'm following this video Tic Tac Toe using c - YouTube to develop a Tictactoe game. In which the developer is using a structure and it's declared like this

struct myDataType {
...
21. ## Thread: Assigning value to structure members using -> operator

by Athul
Replies
8
Views
568

### Thanks for clarifying the difference I...

Thanks for clarifying the difference

I understand how this works

struct person x;
scanf("%s%d%f", x.name, &x.age, &x.weight);
22. ## Thread: Assigning value to structure members using -> operator

by Athul
Replies
8
Views
568

### That was my question, need of & in ptr, even...

That was my question, need of & in ptr, even though ptr is already the address

In the first answer i got for this post

So, back to your question. It looks like &(ptr+i)->name is actually wrong....
23. ## Thread: Assigning value to structure members using -> operator

by Athul
Replies
8
Views
568

### changing this for(i =0; i < num;++i) { ...

changing this

for(i =0; i < num;++i)
{
printf("Enter name, age and weight of the person respectively:\n");
scanf("%s%d%f",&(ptr+i)->name,&(ptr+i)->age,&(ptr+i)->weight);
}
24. ## Thread: Assigning value to structure members using -> operator

by Athul
Replies
8
Views
568

### Assigning value to structure members using -> operator

#include<stdio.h>
#include<stdlib.h>
struct person {
int age;
float weight;
char name[30];
};

int main()
{

by Athul
Replies
4
Views
1,618