Aspire Faculty ID #13678 · Topic: JAMIA MILLIA ISLAMIA MCA 2023 · Just now
JAMIA MILLIA ISLAMIA MCA 2023

How many times this statement will execute: for (; *s == *t && *t != '\0'; s++, t++) if both character pointers ‘s’ and ‘t’ point to the same string “abc”.

Solution

Solution: String = "abc" → characters: a, b, c, '\0' Loop condition: - Iteration 1: *s = 'a', *t = 'a' → true - Iteration 2: *s = 'b', *t = 'b' → true - Iteration 3: *s = 'c', *t = 'c' → true - Iteration 4: *s = '\0', *t = '\0' → fails because *t != '\0' → false Hence, loop executes **3 times**.

Previous 10 Questions — JAMIA MILLIA ISLAMIA MCA 2023

Nearest first

Next 10 Questions — JAMIA MILLIA ISLAMIA MCA 2023

Ascending by ID
Ask Your Question or Put Your Review.

loading...