language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*128. Descubra (e imprima) o valor da maior varivel do exerccio anterior, atravs da funo maior,
cujos parmetros devem ser as variveis ponteiros para m e n.*/
#include<stdio.h>
int maior(int *ptrm, int *ptrn){
if(*ptrm>*ptrn){
printf("\nM e o maior valor: ");
printf("%d", *ptrm);
}
if(*ptrn>*ptrm){
printf("\... |
C | /**
˼·
ڡѵҪ¼вַͬĸ
룺ַͬ = ڵĿ C ͬ細ΪABCCA,BCĿֱΪ112,ͬĸΪ 4 C 2
Windows¼ǰиַӦĸ
MaxSame¼ǰͬĸ
MaxSameIndex¼ͬĸ±ꡣ
*/
#define MAX 256
#define GET_MAX(x, y) ((x) > y) ? (x) : (y)
int characterReplacement(char * s, int k)
{
int windows[MAX] = {0};
int diffNum = 0;
int left = 0;
int right;
int max = -1;
int maxS... |
C | #ifndef COZY_INTERPRETER_VARIABLE_REGISTER_H
#define COZY_INTERPRETER_VARIABLE_REGISTER_H
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include "constants.h"
#include "string_operations.h"
#include "instruction.h"
typedef enum {
INT,
NOT_A_TYPE
} variable_type_t;
typedef struct nod {
int ... |
C | #ifndef JAM_H
#define JAM_H
#include "boolean.h"
/* *** Definisi TYPE JAM <HH:MM:SS> *** */
typedef struct {
int HH; /* integer [0..23] */
int MM; /* integer [0..59] */
int SS; /* integer [0..59] */
} JAM;
/* *** Notasi Akses: selektor JAM *** */
#define Hour(J) (J).HH
#define Minute(J) (J).MM
#def... |
C | /* Copyright 2015 Codethink Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 105
int map_in[MAX][MAX] = {{0}};
int map_out[MAX][MAX] = {{0}};
void printout(int term,int n, int m);
int main(void)
{
//freopen("testout.txt","w+",stdout);
int i, j;
int m,n;
int term;
scanf("%d",&term);
while(term--)
{
memset(map_out... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
char logged_in_name[20];
char logged_in_id[20];
int login_status;
int reg_status;
void user_login();
int teacher_select();
void logout();
void ratting_check(int n)
{
FILE *ratt_fp;
char ratt_name[20], temp;
int ratt_num, ratt_sum... |
C | #include "holberton.h"
#include <stdio.h>
/**
* _strchr - Locates a character in a string.
* @s: Variable with the string input.
* @c: Variable that contain the char to locate.
* Return: c, pointer to initial value.
*/
char *_strchr(char *s, char c)
{
int i;
for (i = 0; s[i] != '\0'; i++)
{
if (*(s + i) == ... |
C | //
// cube.c
//
//
// Created by Simon Boigelot & Edward Nicol on 29/04/2015.
//
//
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
typedef struct {
int *elem;
double *X;
double *Y;
double *Z;
int nElem;
int nNode;
int nLocalNode;
} femMesh;
femMesh *femMes... |
C | bool isAnagram(char* s, char* t) {
int bitMaps[26] = {0}, bitMapt[26] = {0}, lens = strlen(s), lent = strlen(t), i = 0, j = 0;
bool res = false;
if (lens != lent)
goto ret;
while (1) {
if (i != lens)
bitMaps[s[i++]-'a']++;
if (j != lent)
bitMapt[t[j+... |
C | // Compile this assignment with: gcc main.c -o main
//
// Include parts of the C Standard Library
// These have been written by some other really
// smart engineers.
#include <stdio.h> // For IO operations
#include <stdlib.h> // for malloc/free
// Our library that we have written.
// Also, by a really smart engineer!... |
C | /*******************************************************************
*
* @FileName Data_Process.c
* @Date 2017.03.03
* @Author DS.Chin
*
*********************************************************************/
#include "Data_Process.h"
/* @Gloable Variables --------------------------------------*/
_Flag NetCh... |
C |
#include <stdio.h>
int main()
{
int array[100], n, i, j, position, t;
printf("Enter number of elements\n");
scanf("%d", &n);
printf("Enter %d integers\n", n);
for (i = 0; i< n; i++)
scanf("%d", &array[i]);
for (i = 0; i < (n - 1); i++) // finding minimum element (n-1) times
{
position = i;
... |
C | //ʵֱַstrcmpַȽϺӼֵַȽϴСǰߴں1ǰСں-10
#include<stdio.h>
#include<string.h>
int strcmp_(char *st1,char *st2);
int main()
{
char A[100],B[100];
while(scanf("%s %s",A,B)!=EOF)
{
int Num=strcmp_(A,B);
if(Num>0)
printf("1\n");
else
if(Num<0)
... |
C | void InsertionSortCLang(int* a, int size)
{
int i,j,temp;
for(i=1;i<size;i++)
{
temp=a[i];
j=i-1;
while(j>=0 &&a[j]>temp)
{
a[j+1]=a[j];
j-=1;
}
a[j+1]=temp;
}
} |
C | #include "../include/read_line.h"
#include "../include/tlpi_hdr.h"
#include <fcntl.h>
#include <netdb.h>
#include <pthread.h>
#include <signal.h>
#include <sys/mman.h>
#include <sys/sendfile.h>
#include <sys/socket.h>
#include <sys/stat.h>
#define PORT_NUM "50004"
#define BACKLOG 50
#define BUF_SIZE 1000
#define MAX_F... |
C | /*#include <stdio.h>
int main() {
int a;
printf("Inserire Int: ");
scanf("%d", &a);
printf("%d",a);
return 0;
}
#include <stdio.h>
int main()
{
int a;
float b;
printf("Enter integer and then a float: ");
// Taking multiple inputs
scanf("%d%f", &a, &b);
printf("You entere... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(int argc, char **argv)
{
char *vector = (char *) malloc(4);
memset(vector, 'a', 6);
printf("%d\n", strlen(vector));
//prezapiswa
vector = (char *) realloc(vector, 6);
free(vector);
vector = NULL;
free(vector);
return 0;
}
|
C | /**
* Requiments:
* 1. Given a linked list, remove the nth node from the end of list
* and return its head.
* 2. Think about the time complexity and space complexity
* of you function and write it in your report.
*
* For example:
* Given linked list: 1->2->3->4->5, and n = 2.
* After removing t... |
C | #include "BRMixFile.h"
#include <ctype.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef unsigned char byte;
struct BRMixFile
{
char *_filename;
BRMappedFileRef _mappedFile;
uint16_t _entryCount;
uint32_t _size;
struct _BRMixFileEntry *_entries;
};
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#define BUFFER_SIZE 256
int cree_socket_tcp_ip()
{
int sock;
struct sockaddr_in adresse;
if ((sock = socket(AF_INET,... |
C | #include "Stack.h"
int secondStack [1000];
void enqueue (int entity)
{
push(entity);
}
int dequeue()
{
if (top <= 0)
{
printf("Queue is empty\n");
return 0;
}
else
{
int result;
int count = 0;
while (top > 0)
{
secondStack[count++]... |
C | //https://www.tldp.org/LDP/lpg/node81.html
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <ctype.h>
#include <string.h>
#define SEGSIZE 100
void usage();
void writeshm(int shmid, char *segptr, char *text);
void changemode(int shmid, char *mode);
void... |
C | /*
* Author: Meet Udeshi
*/
#include <stdint.h>
#include <stdbool.h>
#include "inc/tm4c123gh6pm.h"
#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "inc/hw_gpio.h"
#include "driverlib/sysctl.h"
#include "driverlib/interrupt.h"
#include "driverlib/timer.h"
#include "driverlib/gpio.h"
#define RED GPIO_PI... |
C | #include<stdio.h>
#include<stdlib.h>
#define white 1
#define gray 2
#define black 3
typedef struct edge{
int i;
struct edge *next;
}edge;
typedef struct node{
int i,d,f,color;
edge *next;
}node;
typedef struct gve{
int v,e;
node *g;
}gve;
typedef struct link_element{
int i;
struct link_element *next;
}link_elem... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include "sqlite3.h"
#include "cgic.h"
int cgiMain()
{
cgiHeaderContentType("text/html");
fprintf(cgiOut, "<HTML>\n");
fprintf(cgiOut, "... |
C | #include <stdio.h>
void ft_sort_int_tab(int *tab, int size);
int main()
{
int i;
int a[6] = {6, 2, 4, 3, 5, 1};
for(i = 0; i < 6; i++)
{
printf("%d, ", a[i]);
}
printf("\n");
ft_sort_int_tab(a, 6);
for(i = 0; i < 6; i++)
{
printf(": %d, ", a[i]);
}
}
|
C | #include <time.h>
#include <stdlib.h>
#include <stdio.h>
/**
* main - generates passwords of random value
*
* Return: 0 always.
*/
int main(void)
{
int randomchar, sum = 0;
srand(time(0));
while (sum < 2772 - 127)
{
randomchar = rand() % 127;
if (randomchar > 32)
{
putchar(randomchar);
sum += rando... |
C | #include <linux/module.h>
#include <linux/kernel.h>
#include <linux/proc_fs.h>
#include <linux/string.h>
#include <linux/vmalloc.h>
#include <linux/uaccess.h>
#include <linux/list.h>
#include <linux/ftrace.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Pablo Jimenez Cruz & Juan Chozas Sumbera");
DEFINE_SPINLOCK(sp);
#defi... |
C | fillUsingRowColumnAnalysis()
{ n=0;
for(i=0 to 8)
{ value=0
Set currentRow=rows[i],temp=Set(1,2,..,9), temp2
temp= temp-currentRow
while((value=temp.getNextElement()))
for(j=0 to 8)
if( cells[i][j] to be filled)
if(cells[i][j].PossibleValues.search(value)= found)
{ temp2=cells[i][j].Possibl... |
C | #include <stdio.h>
#define BUFSIZE 32
int main(void)
{
FILE *fp;
char buf[BUFSIZE];
char *retp;
fp = popen("cat /etc/passwd", "r");
/* if error */
while (1) {
retp = fgets(buf, BUFSIZE, fp);
if (retp == NULL) {
break;
}
printf("\033[31m%s\033[0m", buf);
fflush(stdout);
}
pclose(fp);
return 0... |
C | /*
* uart.c
* @author: Jacob Vaughn, Nick Lorenze
* @date: Feb 21, 2019
*/
#include "uart.h"
// Initialize UART
void uart_init(void)
{
//Enable the UART module using the RCGCUART register
SYSCTL_RCGCUART_R |= 0b00000010;
//Enable the clock to the appropriate GPIO module via the RCGCGPIO register
... |
C | #include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <readline/readline.h>
#include <readline/history.h>
#include "parse.h"
#include <sys/wait.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
/*
Cameron Fabbri
Operating Systems Lab
shell.c
2... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <dirent.h>
#include <string.h>
#include <time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include "phase2.h"
// You are free to use your own logic. The following points are just for getting started
/* Map ... |
C | #include <stdio.h>
#include <stdlib.h>
int partition1(int A[], int m, int n);
void swap(int list[], int i, int j);
int kthSmall(int A[], int k, int lo, int n);
int main()
{
int num[] = {0, 53, 12, 98, 63, 18, 32, 80, 46, 72, 21};
int n = 10;
int d = 0;
int k = 2;
for (int i = 1; i <= n; i++)
... |
C | /*============================================================================
DPRNN(a,b; c1,c0)
Digit product.
Inputs
a, b : nonnegative BETA-digits.
Outputs
c1, c0 : the unique nonnegative BETA-digits such that a * b =
c1 * BETA + c0.
Note: This program assumes that BETA ... |
C | #include<stdio.h>
main()
{
int a[]={10, 20, 30, 40, 50};
char *p;
p = (char *)a;
printf("%d\n", *(p+1));
printf("%d\n", *(p+16));
printf("%d\n", *((int *)p+4));
}
|
C | #include<stdio.h>
void main()
{
int a,b,n=0,i,j;
scanf("%d%d",&a,&b);
for(i=a;i<=b;i++)
{
for(j=2;j<=i/2;j++)
{
if(j*j==i)
{
n++;
}
}
}
printf("%d",n);
}
|
C | #include <stdio.h>
#define MAX_N 2000
#define MAX_L 1000
int n;
int ls[MAX_N];
int ms[MAX_L+1];
void sort(int n) {
for (int i = 0; i < n; i++) {
ms[ls[i]]++;
}
int i = 1;
int j = 0;
while (i < MAX_L+1) {
while (ms[i] > 0) {
ls[j++] = i;
ms[i]--;
}
... |
C | #include<stdio.h>
#include<conio.h>
void main()
{
int i,sum=0,r,temp,temp1;
clrscr();
for(i=0;i<200;i++)
{
temp=i;
temp1=i;
while(temp>0)
{
r=temp%10;
sum=sum*10+r;
temp=temp/10;
}
if(sum==temp1)
{
printf("%d\t",sum);
}
sum=0;
}
getch();
} |
C | #include "byte_buffer.h"
#include "debug.h"
/* Allocate new byte buffer */
byte_buffer_t *byte_buffer_alloc()
{
byte_buffer_t *bb = (byte_buffer_t *)malloc(sizeof(byte_buffer_t));
bb->buf = (uint8_t *)malloc(FRAG);
memset(bb->buf, 0, FRAG);
bb->bufsize = FRAG;
bb->wpos = 0;
bb->rpos = 0;
return bb;
}
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "funcionesExtra.h"
int menuOpciones()
{
int opcion;
printf("1-Alta de alumnos \n");
printf("2-Ver listado de alumnos \n");
printf("3-Ordenar alfabeticamente \n");
printf("4-Alumnos aprobados \n");
printf("5-Alumnos cuyo nombr... |
C | /*
* This file is part of the OpenMV project.
*
* Copyright (c) 2013-2021 Ibrahim Abdelkader <iabdalkader@openmv.io>
* Copyright (c) 2013-2021 Kwabena W. Agyeman <kwagyeman@openmv.io>
*
* This work is licensed under the MIT license, see the file LICENSE for details.
*
* Rectangle functions.
*/
#include "imlib.... |
C |
#include<stdio.h>
#include<string.h>
#define sz 1000
int main()
{
char arr[sz];
int n,i,sum=0,d,j;
scanf("%d",&n);
//printf("%d",sum);
for(i=0;i<n;i++)
{
scanf("%s",arr);
d=strlen(arr);
sum=0;
for(j=0;j<d;j++)
sum+=arr[j];
... |
C | /******** mish.c **********/
// gcc -o mish mish.c
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/wait.h>
#define MAX_LINE 80
#define MAX_NUM_ARGS 10
size_t string_parser(char *input, char *word_array[]) {
size_t n = 0;
while (*input) {
while (isspace((... |
C | #include "ia.h"
#include "time.h"
/* ============================== FUNCIÓN PRINCIPAL ======================= */
void
tirar_ai(struct tablero *un_tablero)
{
/* Revisa si podemos comer y cuanto ganaríamos*/
int comer = podemosComer(un_tablero);
/* Revisa si nos pueden comer y cuanto perde... |
C | #include "holberton.h"
void helper_err(int f, int c, char *str2i, int fd);
/**
* main - main function
* @argc: Amount of args
* @argv: Value of args
* Return: sometimes
*/
int main(int argc, char **argv)
{
char buffer[1024];
int file1, file2, written, closed;
ssize_t count;
helper_err(9, argc, argv[1], 0);
... |
C | /*
** EPITECH PROJECT, 2020
** minishell
** File description:
** main file
*/
#include <stdlib.h>
#include "my.h"
void print_cmd_continue(minishell_t *shell)
{
my_putstr(BLUE);
my_putstr(shell->floca);
if (shell->result != 0)
my_putstr(RED);
else
my_putstr(GREEN);
my_putstr(" $ ");... |
C | long repeatedString(char* s, long n) {
long i, num, a_ct, rem, ct = 0;
int len = strlen(s);
for(i=0; i<len; i++)
{
if(s[i] == 'a')
ct++;
}
num = n/strlen(s);
a_ct = ct * num;
if(n % len != 0)
{
rem = n % len;
for(i=0; i<rem; i++)
{
... |
C | #include<stdio.h>
#include<stdlib.h>
#include"add.h"
int main()
{
int a = 10;
int b = 20;
int sum = ADD(a,b);
printf("%d\n",sum);
return 0;
}
|
C | /* Menu du TP 5 - Arbre AVL / quilibrage */
#include<stdio.h>
#include<stdlib.h>
#include "ab.h"
void purge(){
char c;
do{
scanf("%c", &c);
}while(c!='\n');
}
/* affiche l'arbre dans l'ordre croissant */
void afficher(t_noeud* n)
{
if(!arbre_vide(n)){
printf("%d ", val_noeud(n));
//printf("... |
C | #include <stdlib.h>
#include <stdio.h>
#include "matrix.h"
double _random(const double min, const double max)
{
return ((double) rand() / RAND_MAX) * (max - min + 1) + min;
}
int **createMatrix(size_t n, size_t m)
{
int **matrix;
if ((matrix = (int **) malloc(n * sizeof(int *))) == NULL)
{
... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | #include <stdio.h>
#include "./libdoublylinkedlist/DoublyLinkedList.c"
int main() {
DoublyLinkedList* mylist = create_doubly_linked_list();
printf("Pushing numbers to linked list\n");
for (int i = 1; i <= 5; i++) {
printf("Pushing, %d...\n", i * 10);
push(i * 10, mylist);
}
printf("\nLinked List:\n... |
C | #include <stdio.h>
#include <stdlib.h>
#include<string.h>
#include <unistd.h>
int send_mode = 0;
int max_mail_len = 2000;
int max_output_line = 500;
int main(int argc, char** argv){
int sender = 0;
int data = 0;
char* mail_address = NULL;
char* title = NULL;
char body[max_mail_len];
for(int i = ... |
C | #include <unistd.h>
#include <stdlib.h>
void ft_putnbr(int nb)
{
int i;
if (nb < 0)
{
write(1, "-", 1);
nb *= -1;
}
i = '0' + (nb % 10);
if (nb > 9)
ft_putnbr(nb / 10);
write(1, &i, 1);
}
int main(int ac, char **av)
{
if (ac == 2)
{
ft_putnbr((atoi(av[1])));
}
}
|
C | #ifndef KFIFO_H_
#define KFIFO_H_
//声明 一个 结构体 kfifo
#include <stdint.h>
struct KFIFO
{
unsigned char *buffer; /* the buffer holding the data */
unsigned int size; /* the size of the allocated buffer */
unsigned int in; /* data is added at offset (in % size) */
unsigned in... |
C | #include<stdio.h>
#include<sys/types.h>
void main()
{
pid_t pid;
pid = fork();
if(pid == 0)
{
printf("Child Process!\n");
}else{
printf("hi %d\n",pid);
}
}
|
C | #include <stdio.h>
#include "graph.h"
int main(){
Graph *graph = make_Graph();
int i;
int numOfNode, numOfEge;
int a, b, weight;
int *result;
int start;
/* 頂点の数と辺の数の入力 */
printf("頂点の数を入力してください: ");
scanf("%d", &numOfNode);
printf("辺の数を入力してください: ");
scanf("%d", &numOfEge);
/* ノードをつくる */
for(i = 0; i < ... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | /*--------------------------------------------------------------------------------------------------------------------------*/
/*---------------------------------------FreeRTOS General Example------------------------------------------------------------*/
/*---------------------------------------------------------------... |
C | int printf(char *s, ...);
struct S { int i,j; };
struct S s0={30,40};
struct S const s1={50,60};
void f() { printf("f()\n"); }
void g() { printf("g()\n"); }
void f0(double x) {
struct S *p;
void *q;
printf("%d\n",x?10:20);
printf("%d\n",(x?s0:s1).j);
x?f():g();
printf("%d\n",(x?&s0:&s1)->j);
p=x?&s0:0;... |
C | /*-------------------------------------------------------------------------------------------------------------------------------
strinsert.c
Program to insert a string into another
DIVYA RAJ K
11-11-2018
------------------------------------------------------------------------------------------------------------------... |
C | #ifndef _UTILSC_
#define _UTILSC_
int isValid (char value, char * validChars) {
int i = 0;
while(validChars[i]){
if (value == validChars[i++]) return value;
}
printf("\nINVALID INPUT. Please try again.\n");
return 0;
}
#endif
|
C | /** @file utils.c
Various utility functions (not platform-specific, "portable")
*/
#include "utils.h"
#include "globals.h"
#include "log.h"
#include <sys/stat.h>
/** isprint(c) substitute
The standard function won't allow chars >= chr(128).
We'll accept anything that's neither a control char nor DEL.
*/
#define ISP... |
C | // fixed wear/unwear to use ETO, added obvious short-last change was 7/98 *Styx*
#include <std.h>
inherit ARMOUR;
void create(){
::create();
set_name("amulet");
set_id(({"amulet","amulet of warding"}));
set_obvious_short("%^BOLD%^%^CYAN%^wooden amulet%^RESET%^");
set_short("%^BOLD%^%^CYAN%^Amule... |
C | #include <stdio.h>
#include "matrix.h"
Matrix matrix_create(int row, int col)
{
Matrix mat = {.row=row, .col=col};
mat.values = malloc(sizeof(*(mat.values)) * row);
return_val_if_fail(mat.values != NULL, (Matrix){0});
mat.values[0] = calloc(row, sizeof(*(mat.values[0])) * col);
return_val_if_fail... |
C | /*
Title : Find mid, Find_nth_from_list
Date : 15/12/19
Author : Sahana
Description : Input : Read input from user
Output : Display on screen
*/
#include "queue.h"
int main()
{
//Declaring variables
qlist *rear = NULL,*front = NULL;
data_t val;
int result,option;
while(1)
{
//... |
C | #include<stdio.h>
using namespace std;
// ãƳ Լ
int sort(int n, int Array_1[]) {
int i, j, temp;
int k, l, p;
int count = 0;
int result;
int* Array_2 = new int[n];
int* Array_3 = new int[n];
//Է°
for (i = 0; i < n; i++) {
for (j = 0; j < n - 1; j++) {
if (Array_1[j] > Array_1[j + 1]) {
... |
C | #include<stdio.h>
#include<stdlib.h>
#define N 3
int queue[3][N];
int front[3]={0,0,0};
int rear[3]={-1,-1,-1};
int item,pr;
void pqinsert(int);
void pqdelete();
void display();
int main()
{
int ch;
for(;;)
{
printf("\nPRIORITY QUEUE\n");
printf("*****************\n");
printf("... |
C | #include "listmaker.h"
task_t* createTask(unsigned int id, unsigned int arrival_time) {
task_t* new_task = (task_t*) malloc(sizeof(task_t));
if (new_task == NULL) {
perror("Error while creating a new task");
exit(EX_OSERR);
}
new_task->id = id;
new_task->arrival_time = arrival_time... |
C | #include<stdio.h>
int main()
{
int i,n;
scanf("%d %d",&i,&n);
if((i*n)%2==0)
{
printf("even");
}
else
{
printf("odd");
}
}
|
C | // Wizard: Khojem
// orc3
// orc3.c
#include <std.h>
inherit ROOM;
int no_exit() { return 1;}
void init() {
::init();
if(this_player()->chk_my_mon()) {
add_action("no_exit","south");
add_action("no_exit","east");
add_action("no_exit","west");
}
}
void reset() {
::rese... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | #include <stdlib.h>
#include <stdio.h>
#include "jlbmath.h"
int gcd_a, gcd_b;
float abs_a, sqrtv;
int main() {
printf("Enter first digit: ");
scanf("%d", &gcd_a);
printf("\nEnter second digit: ");
scanf("%d", &gcd_b);
printf("\nGCD is: %d\n", gcd(gcd_a, gcd_b));
printf("Enter number: ");
s... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX 256
int compare(char p[], char t[])
{
int i;
for(i=0; i<MAX; i++)
{
if(p[i] != t[i])
{
return 0;
}
}
return 1;
}
void search(char p[], char t[])
{
int pl, tl, i;
char plc[MAX] ={0},... |
C | #include <stdio.h>
void exchange(int A[], int i, int j)
{
int temp = A[i];
A[i] = A[j];
A[j] = temp;
}
int partition(int A[], int left, int right)
{
int pivot = A[right];
int tail = left - 1;
for (int i = left; i < right; i++)
{
i... |
C | 编制程序,将N*N的矩阵转置。
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define N 4
int main()
{
int a[N][N];
int i,j,temp;
//用随机数填充二维数组a
srand(time(0));
for(i=0;i<N;i++)
{
for(j=0;j<N;j++)
{
a[i][j] = rand()%100;
printf("%4d",a[i][j]);
}
printf("\n");
}
//矩阵转置
for(i=0;i<N;i++... |
C | // ----------------------------------------------------------------------------
//
// TIMERmain.c
//
// sets up periodic main loop timer and interrupt
// requires mainISR() to be the TIMER0A_Handler in Startup.s
//
// ----------------------------------------------------------------------------
// INCLUDE
// -------... |
C | /*
Eric Brewer
9/10/09
CS252
Lab2_1 - 8-bit signed integer conversion
*/
#include <stdio.h>
#include <stdlib.h>
int main(){
int input = 0;
printf("Enter a signed decimal integer: ");
scanf("%i", &input);
//printf("\n");
if(input >= -128 && input <= 127){
if(input < 0)
input += 256;
... |
C | //
// Created by Ivan's PC on 11/14/2019.
//
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
char * leer(){
char * cad = NULL;
int i = 0;
char c;
while ( (c=getchar())!='\n'){
if (i>0){
cad = (char*) realloc(cad, (i+2)* sizeof(char));
} else{
cad = (c... |
C | #ifndef EVENT_H
#define EVENT_H
#include <stdbool.h>
#include <stdint.h>
typedef enum {
E0 = 0u,
E1 = 1u,
E2 = 2u,
E3 = 3u,
END = 255u,
} Event;
#define QLEN (4) // the lenght of queue, must known in application design
typedef struct {
uint8_t curEvent; // the first event of queue
uint8_t... |
C | /*******************************************
* Game of Chance
*******************************************/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <time.h>
#include "error_check.h"
#define DATAFILE "/var/chance.data" // Arquivo para armazenar os dados do ... |
C | /*
*
* Compiler for the Bare Bones programming language written in C
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct var
{
char key[10];
int value;
};
int main(int argc, char *argv[])
{
FILE *fptr;
struct var bones[200];
struct var *listptr = &bones[0]; // pointer for the variable ... |
C | #include "xsal.h"
#include "xsal_i_assert.h"
#include <errno.h>
#include <string.h>
bool SAL_Create_Mutex(
SAL_Mutex_T* mutex,
const SAL_Mutex_Attr_T* attr)
{
SAL_Int_T status;
SAL_PRE(mutex != NULL);
if (attr == NULL)
{
/** Create mutex with default (system dependent) settings
*/
... |
C | /*
Parallelise PI program using loop construct
*/
#include<stdio.h>
#include<omp.h>
static long num_steps=100000;
double step;
int main()
{
int i;
double pi;
double sum=0.0;
step = 1.0/(double) num_steps;
#pragma omp parallel
{
double x;
#pragma omp for reduction(+:sum)
... |
C | #include <stdio.h>
#include <stdlib.h>
#include "QueryUtil.h"
#include "SegUtil.h"
/**
* ORs the next 2 segments (2 fills) and stores result
*/
void fillORfill(activeWord *smallFill, activeWord *bigFill, activeWord *result){
word_32 runSize = getNumRuns(smallFill->seg[smallFill->currSeg],smallFill->length);
bigFil... |
C | #include <stdio.h>
#include <time.h>
#include "myBmpGris.c"
/**
CoeffLeg : Cette fonction calcule les coefficients des polynomes de Legendre
jusqu' l'ordre n et renvoie une structure comprennant la matrice et ses dimensions
@param n : ordre du polynome de Legendre
*/
MATRIX CoeffLeg(int n)
{
... |
C | /************************The MSB bit of a number defines their sign. If the MSB bit is set, the number will be negative.******/
#include <stdio.h>
int main()
{
int sign = 0;
int data = 0;
int val;
printf("Enter a number:");
scanf("%d",&data);
sign = (data > 0) - (data < 0);
val = (data > 0);
printf("val = %d\n"... |
C | /* 先以只读模式"r"打开名为"abc"的文件,然后将它关闭。
* 当文件打开失败,fopen函数返回NULL时,会显示“无法打开文件"abc"。否则则证明文件可以正常打开,所以显示“成功打开文件"abc",并关闭文件。
*/
/* 代码清单13-1中的程序只能打开名为"abc"的文件。请将程序改为从键盘读入文件名,如果存在该名称的文件,就显示“该文件存在。”,否则就显示“该文件不存在。”。
*/
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv) {
/* argc -> 参数的个数 >= 1 */
/* arg... |
C | #include <inttypes.h>
#include <stdlib.h>
uint64_t read();
void write(uint64_t val);
void matmul(uint32_t dim, uint64_t* c, uint64_t* a, uint64_t *b) {
uint32_t i, j, k;
// C = AB
for (i = 0; i < dim; i++) {
for (j = 0; j < dim; j++) {
uint64_t sum = 0;
for (k = 0; k < dim; k++)
sum +=... |
C | #include<stdio.h>
#define MAX 1005
int main()
{
int n,a[MAX][3];
int i,j;
int at=0,bt=0,ar=0,br=0;
scanf("%d",&n);
for(i=0;i<n;i++)
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
for(i=0;i<n;i++)
{
if(a[i][0]==1)
{
at+=10;
... |
C | //
// Created by harsha on 2019-05-27.
//
#include "state.h"
cell *** create_singleton_state() {
cell *** state = create_cell_grid();
return state;
}
void write_to_singleton_state(cell *** oldstate, cell *** newstate) {
int i, j;
for (i = 0; i < ROWS; i++) {
for(j = 0; j < COLUMNS; j++){
... |
C | #include<stdio.h>
int main()
{
int num,num_cp,num_sq,lastdigit;
printf("enter the no \n");
scanf("/d",&num);
num_cp=num;
num_sq=num*num;
while(num_sq>0)
{
lastdigit=num_sq%10;
if(lastdigit==num_cp)
printf("Automorphic no. %d",num);
else
printf("Not an Automorphic... |
C |
//------------------------------------------------------------------------
// NAME: Mihail Kirov
// CLASS: XIb
// NUMBER: 19
// PROBLEM: #2
// FILE NAME: png-info.c
// FILE PURPOSE:
// get the width and height of PNG image
//------------------------------------------------------------------------
#include <stdint.h>
#... |
C | #include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<string.h>
int nbOfE;
int* createArr(){
int *p = (int*)malloc(sizeof(int)*10000000);
return p;
}
void swap(int* a, int* b){
int tmp = *a;
*a = *b;
*b = tmp;
}
void generateArr(int* p, int n){
srand((int) time(0));
for(int i = 0... |
C | #include<stdio.h>
#include<conio.h>
int main()
{
int num1,num2;
clrscr();
printf("Enter any two numbers");
scanf("%d%d",&num1,&num2);
switch(num1>num2)
{
case 0:
printf("%d is maximum",num2);
break;
case 2:
printf("%d is maximum",num1);
break;
}
getch();
re... |
C | #include<stdio.h>
typedef struct singleLL{
int data;
struct singleLL *next;
}node;
void create(node *l){
int i,ch;
while (1){
printf("Enter data:");
scanf ("%d",&l->data);
printf("Enter more data?(0/1)");
scanf ("%d",&ch);
if(ch==0){
l->next='\0';
break ;
}
node *t=(node*)malloc(... |
C | /*
** EPITECH PROJECT, 2018
** CPE_corewar_2017
** File description:
** Labels writter
*/
#include "asm/writter/labels_writter.h"
#include "asm/utils/clean_str.h"
void init_labels(label_t *label_s, asm_t *asm_s)
{
size_t i = 0;
for (; asm_s->labels[i] != NULL; i++) {
label_s[i].label = asm_s->labels[i];
label_... |
C | #include <string.h>
#include "string_t.h"
/**
* Initializes all fields of string_t struct. If str.buf is already
* allocated, it is not freed.
*/
void string_set(string_t *str, const char *val) {
size_t val_len = strlen(val);
if (val_len >= string_t_initial_capacity) {
str->buf = (char *) calloc(va... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.