Code:

#include <stdio.h>

struct Student {
    int roll;
    char name[50];
    float marks;
};

int main() {
    struct Student s;
    struct Student *ptr = &s;

    printf("Enter Roll Number: ");
    scanf("%d", &ptr->roll);

    printf("Enter Name: ");
    scanf(" %49[^\n]", ptr->name);  // reads string with spaces

    printf("Enter Marks: ");
    scanf("%f", &ptr->marks);

    printf("\nStudent Details:\n");
    printf("Roll No: %d\n", ptr->roll);
    printf("Name: %s\n", ptr->name);
    printf("Marks: %.2f\n", ptr->marks);

    return 0;
}

Explanation:

Structure Definition:
The Student structure groups roll number, name, and marks together for clean and organized data handling.

Pointer Usage:
The pointer ptr is used to access and modify structure members using the arrow operator ->.

Input Handling:
The name input uses scanf(" %49[^\n]", ptr->name) to correctly capture names with spaces.

Output:
Student details are printed using the pointer to structure, showing proper use of ptr->member notation.