#include #include void extractData(char frame[]) { // Check for bit stuffing int count = 0; char unstuffed[1000]; for (int i = 0, j = 0; frame[i]; i++) { unstuffed[j++] = frame[i]; if (frame[i] == '1') count++; else count = 0; if (count == 5) { i++; // Skip the stuffed bit count = 0; } } unstuffed[strlen(frame) - count] = '\0'; // Null terminate the unstuffed frame printf("Data after bit unstuffing: %s\n", unstuffed); // Checksum validation int checksum = 0; for (int i = 0; i < strlen(unstuffed); i++) checksum += unstuffed[i]; if (checksum == 0) printf("Checksum passed.\n"); else printf("Checksum failed.\n"); // Character count extraction int charCount = unstuffed[0] - '0'; // First character represents the count printf("Data after character count extraction: %s\n", &unstuffed[1]); } int main() { char frame[1000]; printf("Enter the frame: "); scanf("%s", frame); extractData(frame); return 0; }