Pointer to Structure

Medium Pointer Fundamentals
Solve in Playground →

Problem Statement

Write a C program to define a simple structure and access its members using a structure pointer and the arrow operator (->).

Input Format

ID (int) and Score (float) space-separated.

Output Format

Print structure members accessed via pointer.

Constraints

ID >= 0, Score 0.0 to 100.0

Sample Input

101 85.5

Sample Output

ID: 101, Score: 85.50

Explanation

Assign the address of a structure instance to a pointer and use `ptr->member` to read or modify fields.

Starter Code

#include <stdio.h>

struct Record {
    int id;
    float score;
};

int main() {
    struct Record r;
    if (scanf("%d %f", &r.id, &r.score) == 2) {
        struct Record *ptr = &r;
        // Write your code here to print using pointer
    }
    return 0;
}

Limits

  • Time Limit: 1s
  • Memory Limit: 256MB

Embedded C Programming

Updated: March 15, 2026
Intermediate

Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used